Skip to content
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

[Bug]: TranslationSerializerField represented as string in swagger schema, though it requires a dicitonary input #14958

Open
1 task done
KevinMind opened this issue Aug 12, 2024 · 2 comments

Comments

@KevinMind
Copy link
Contributor

KevinMind commented Aug 12, 2024

What happened?

Swagger is automatically inferring a "string" type for fields using "TranslationSerializerField" under the hood it is a CharField, but the i/o represents as a dictionary for each locale having a key/value pair.

What did you expect to happen?

We should update the swagger introspection to represent this field as a dictionary with valid local keys and string values.

Is there an existing issue for this?

  • I have searched the existing issues

┆Issue is synchronized with this Jira Task

@eviljeff
Copy link
Member

It's possibly because under api/v3 and api/v4 Translated fields can be a string - if a lang parameter is passed it'll be a simple string in the response; and a simple string can be provided in a POST/PATCH/PUT to update, as an alternative to a dict/object.

(In api/v5 that was changed - now responses are always a dict/object, and a dict/object must always be provided for an update)

@KevinMind
Copy link
Contributor Author

We could potentially solve this with static annotations on the serializer, however this would also imply we need to consider the version in the static definition... we could ALSO consider dropping support for v3/4 from swagger to simplify and make sure swagger is future focused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants