Is it possible to generate immutable objects by yaml modification?
```yaml
CreatePerson
type: object
**immutable: true** -- Is this possible?
...
properties:
....
Yes, per https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schema-object
type: object
readOnly: true
properties:
myId:
# also legal in properties
readOnly: true
immutable is not the same thing as readOnly. Immutability means that a CREATE can write, but you cannot change it once it is posted.
When I set readOnly property for model, Swagger code generator still generate setters for fields.
Used:
{code}
{code}
Swagger 2.0 & Java 8
Can I make properties for code generator to generate immutable Java POJO models?
Most helpful comment
immutable is not the same thing as readOnly. Immutability means that a CREATE can write, but you cannot change it once it is posted.