Skip to main content

Module direction

Module direction 

Source
Expand description

The request shape and the response shape that readOnly and writeOnly describe.

OpenAPI marks a property readOnly when a response carries it and a request must not, and writeOnly for the opposite. The mark names a direction, not a value, so one struct cannot state both.

Each model therefore drops the properties that its direction does not carry. A model that one direction reaches keeps its name. A model that both directions reach becomes <Name>Request and <Name>Response, and so does every model that both directions reach and that references it.

docs/design.md states the rest of the reasoning.

Constants§

REQUEST_SUFFIX
The suffix the request shape of a split model takes.
RESPONSE_SUFFIX
The suffix the response shape of a split model takes.

Functions§

projected_name
The name a model takes in one direction.
split_by_direction
Project every model a direction mark reaches onto the direction that carries it, and point each API position at the shape it takes.