-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix openapi schema for created resources #6111
Conversation
5f0146e
to
344b9b0
Compare
This is really unfortunate. The old bindings (v4.3.1) seem to be unable to consume the fix that the new ones (v7.*) need. |
Actually, instead of fixing the schema, we make sure the field always returns a string to comply with its definition. This workaround is necessary to be able to consume both new and old bindings generators.
61a2b9f
to
face5c1
Compare
Why the old bindings cant consume the fix? The tests are passing here and it uses the old generator version, doesnt it? Anyway, IHO in the moment we can declare the pulp-openapi-generator version inside pulpcore repo, then we have a clear cut of where we can or not ship such a fix. Do we have a well-defined plan for this? I've seem/hear some discussion here and there but its not entirely clear to me the decisions and problems around the generator pinning. Edit: oh yeah, there is this: pulp/plugin_template#906 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know nothing about the issue, can you provide some context/links?
Sorry, that was an old approach to fixing that didn't work. I tried to fix the api spec to report |
@@ -46,8 +46,7 @@ class TaskSerializer(ModelSerializer): | |||
finished_at = serializers.DateTimeField( | |||
help_text=_("Timestamp of when this task stopped execution."), read_only=True | |||
) | |||
error = serializers.DictField( | |||
child=fields.JSONDictField(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a difference in the structure declaration here:
# DictField with child=JSONDictFeild
{
"key1": { ... },
...
"keyk": { ... }
}
# JSONDictField
{
"key1": Any,
...
"keyk": Any
}
I think I would keep the DictField. The JSONDictField is meant to replace mainly the generic JSONFields where applicable. I dont see a strong reason for doing so here. Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is that the errors as reported by pulp seem to be dicts of any. I'll try and dig up examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you are: It's a dict of mainly strings.
[task.error for task in Task.objects.filter(state="failed")]
[{'traceback': ' File "/usr/local/lib/python3.9/site-packages/pulpcore/tasking/tasks.py", line 68, in _execute_task\n
[...]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks reasonable then
Co-authored-by: Grant Gainey <[email protected]>
No description provided.