s-knibbs / dataclasses-jsonschema

JSON schema generation from dataclasses
MIT License
167 stars 38 forks source link

Support `readOnly` and `writeOnly` OpenAPI 3 keywords #52

Closed s-knibbs closed 5 years ago

s-knibbs commented 5 years ago

OpenAPI 3 supports some additional keywords for property schemas such as readOnly . These could be specified in the field metadata:

@dataclass
class Employee(JsonSchemaMixin):
    id: int = field(metadata=dict(read_only=True), default=-1)
    name: str
    department: str