-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Read-only attributes in model definition #884
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
Comments
(I have Swagger UI |
You understand correctly, it's just not implemented yet. |
Ah, thanks a lot for the info :-) It seems the way to go is to define different models for read and write operations, I'll hold on to that until this is implemented. |
I'd love to see this feature implemented soon, so... ... +1 |
👍 |
I've been looking into this too. I expected a readOnly parameter to be shown as being read only, in a similar way that non required parameters are being shown as optional. The reason I expect this is because the API I'm documenting behaves this way: read only parameters are allowed in PUT requests, but are either simply ignored or checked to not have changed (I've not made up my mind yet on that one). The reason for this is because API consumers should be able to do a GET and then an immediate PUT without needing to delete the read only parameters. I'd like the user to be aware of this behavior somehow. I've come up with a simple patch to do this. However it would behave differently than thegcat's assumption above. I wonder if there's something we can come up with to cover both cases? Reading about this a bit more, the docs say: |
Has any progress been made on this? |
I need this :C |
@ramses132, are you using the 3.x series of Swagger UI? |
i am also need it and i am using 3.x |
I have swagger models defined for some of the things our API can take or give in a request, but the attributes between both are not always the same. In the following example, the
id
cannot be set from the API:I'd though adding
readOnly
to theid
property would remove it from the Model and Model Schema in the "Parameters" section of a request, i.e. in the part where it is used for writing, but this seems to not be the case.Did I understand that option wrong?
The text was updated successfully, but these errors were encountered: