writeOnly field
See original GitHub issueSwagger spec supports a readOnly
field, but I can’t find support for a writeOnly
field (like one may use for a sensitive piece of information like a pan or credentials of some sort). Is there a reason for this omission?
Issue Analytics
- State:
- Created 8 years ago
- Comments:19 (10 by maintainers)
Top Results From Across the Web
Write only, read only fields in django rest framework
Read-only fields are included in the API output, but should not be included in the input during create or update operations. Any 'read_only'...
Read more >Serializer fields - Django REST framework
Serializer fields handle converting between primitive values and internal datatypes. They also deal with validating input values, ...
Read more >Write only fields - Google Groups
Is it possible to have write only fields? E.g. I want the serializer to validate some data in the payload but I don't...
Read more >WriteOnly - Visual Basic - Microsoft Learn
In this article. Remarks; Rules; When to Use WriteOnly; See also. Specifies that a property can be written but not read.
Read more >Write-only Form Elements
2 Preventing DOM access to form fields. 2.1 The writeonly attribute; 2.2 The form-writeonly Content Security Policy directive ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks all - perhaps a bit more context would be helpful. In the Azure API sets, we see that attributes generally follow one of four patterns:
In the case of #1, let’s take the case of a VM password. We need the user to set it, but don’t want to return the password back to the client. It would seem peculiar to model the password as a separate resource, since the password is of no standalone utility - its benefit is only in the context of that particular resource.
@adamaltman @slavcodev The idea mentioned by @casualjim (and @webron) is to have two schemas, one for the “write” use case, the other one for the read one, which are referenced by the operations (in parameter or response definition). In order to duplicate less code, you can have a third one with the fields which are common for both read and write, and then refer to this with an allOf reference. Using
writeOnly
andreadOnly
is only a shortcut for this.