-
Notifications
You must be signed in to change notification settings - Fork 265
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
Proposal for Required Fields #54
Comments
@MissiaL @tsouvarev @jayvdb you guys certainly exposed spectacular to a few code bases. what do you think? |
Sounds good to me |
For me too. I will test you changes |
awesome! i merged it. lets see where it takes us. thanks for checking it out. |
I checked changes We use the request validator https://github.com/p1c2u/openapi-core and now it swears at these required fields |
@MissiaL i just remembered why this is problematic. for us it is primarily a code generator issue. do you use the schema for code generation or only for display? https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#fixed-fields-20
so strictly speaking validation should not complain about that afais. the spec also states that the written word overrules the json schema specification. for us it is mainly a typescript generation issue which i encoutered just now. |
@MissiaL i'm on the fence on reverting this.
i would like to make a more informed decision on how to proceed. |
The problem was in our versioning |
I have not tested this implementation yet. I will study and inform here soon |
spectacular apparently is used by a few people now. i'd like to get some feedback on an idea before doing potentially invasive schema changes.
Theoretically we could make all read-only fields
required
. Which is imho a better representation of what DRF is actually doing. afaik DRF will always render a field even if it isnull
. so it is indeedrequired
and not optional. note that this would only apply to responses and not requests.It is an easy change, but i would like to get feedback beforehand. i don't want to break your schemas/clients. For our purposes it looks very good and the generated clients also honor it well.
i will create a pull request for you to check this out.
The text was updated successfully, but these errors were encountered: