-
Notifications
You must be signed in to change notification settings - Fork 41
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
Spike: OpenAPI spec lists all fields as optional #4775
Comments
This will be spike. A new ticket will be created to implement the solution. |
After looking into this, my recommendation would be to use the By setting the behaviour to
becomes:
By setting the behaviour to
produces the following typescipt type (note that it does not have a
As a result, we can annotate with One limitation is that there is no annotation for fields that are required for requests, but not always populated in responses. If we wanted to work around that case, we would need to create different proto messages for those in the request and those in the response. For example, we could create |
In Protov3 all fields are optional by default, but that means that in our OpenAPI spec, all fields in requests and responses are optional as well. This is causing trouble for the TypeScript generated clients as they need to do custom validation.
It seems like we could add a custom option and annotate the required fields in the proto file, but I don't know if buf has the option to generate the required fields based on custom options. Needs more research.
The text was updated successfully, but these errors were encountered: