Skip to content

Commit

Permalink
πŸ“ Update OpenAPI compatibility doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalkrupinski committed Jun 29, 2024
1 parent 6ec9fda commit d44003c
Showing 1 changed file with 74 additions and 73 deletions.
147 changes: 74 additions & 73 deletions docs/openapi.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,76 @@
# OpenAPI compatibility

- openapi: validated (3.0.* accepted)
- info
- license: Not usable. It's up to the user to verify the accepted use.
- title and other fields: planned as part of project readme
- externalDocs: planned as part of the project readme
- servers: first server is used
- url: used as the base URL
- variables: default values are used to evaluate the server URL
- security: implemented
- tags: ignored, not planned
- components
- schemas:
- title: planned as part of class docstr
- type
- [no value]: planned as primitive JSON-compatible object.
- object: implemented as pydantic models
- array: implemented as list
- string, integer, number, boolean: implemented as str, int, float and bool
- format: planned, including custom formats
- validation keyword: supported by pydantic
- allOf: needs improvement
- oneOf and anyOf: implemented as union
- not: planned for objects
- required: non-required properties are turned to `Union[None, $type]`
- additionalProperties:
- boolean: supported as pydantic `extra: 'allow'` or `'forbid'`
- schema: planned as a `Mapping` field
- patternProperties: planned as `Mapping` field
- enum: ignored; might be implemented for simple types as `Literal`
- description: planned as part of docstr
- default: if present, the property type turned to `Union[None, $type]` and has default value `None`
- caveat: default values are not to be sent between Web API client and server, instead they are implied be the receiving side. Lapidary could potentially fill such values in response models, but it might be expensive, so it's not planned.
- nullable: if true, the property type is turned to `Union[None, $type]`
- readOnly & writeOnly: if either is true, the property type is turned to `Union[None, $type]` and has default value `None`; planned as part of docstr
- caveat: readOnly properties are only to be sent to API server, and writeOnly only to be received by the client. A property might be both required one way, and invalid the other way, which could not be directly represented in Python.
- discriminator: ignored
- example: might be used as part of docstr
- externalDocs: planned as part of docstr
- deprecated: planned
- xml: ignored, currently not planned
- responses
- description: planned as part of docstr
- headers: if present, used as fields in the response envelope class
- content: implemented; used as operation method return type, and a way to resolve model type for a response
- links: ignored; might be used to generate methods in the response envelope
- parameters: used in-line in operations
- examples: ignored
- requestBodies
- description: planned as part of docstr
- content: implemented
- required: planned
- headers: implemented
- securitySchemes: implemented with httpx_auth
- refreshUrl: not supported
- links: planned
- callbacks: not planned
- paths
- summary, description: planned as parts of docstr
- servers: ignored
- parameters
- name: OpenAPI parameter names are not unique and might contain characters invalid for python names, therefore they're escaped and suffix-hungarian notation is used to distinguish between cookie, header, path and query parameters
- in: implemented, suffix-hungarian notation is used to separate parameters
- required: non-required parameters are optional with default value `None`
- deprecated: planned
- allowEmtyValue: planned
- content: key: planned, value: processed as schema
- style: partially implemented
- allowReserved: planned
- schema: implemented
- example & examples: planned
- x-lapidary-name: name of a parameter in the python
- x-lapidary-responses-global: responses that might come from any operation
- x-lapidary-headers-global: headers accepted by any operation
- βœ… `openapi`: validated (3.0.* accepted)
- `info`
- ❌ `license`: N/A; it's up to the user to verify the accepted use.
- πŸ—“οΈ `title` and other fields: planned as part of project readme
- πŸ—“οΈ `externalDocs`: planned as part of the project readme
- βœ… `servers`: first server is used
- βœ… `url`: used as the base URL
- βœ… `variables`: default values are used to evaluate the server URL
- βœ… `security`: implemented
- ❌ `tags`: ignored
- `components`
- βœ… `schemas`:
- πŸ—“οΈ `title`: planned as part of class docstr
- `type`
- πŸ—“οΈ [no value]: planned as primitive JSON-compatible object.
- βœ… `object`: implemented as pydantic models
- βœ… `array`: implemented as list
- βœ… `string`, `integer`, `number`, `boolean`: implemented as `str`, `int`, `float` and `bool`
- πŸ—“οΈ `format`: planned, including custom formats
- βœ… assertion keywords: as supported by pydantic
- ⚠️ `allOf`: needs improvement
- βœ… `anyOf`: implemented as union
- ⚠️ `oneOf`: treated as `anyOf` and implemented as `Union`
- πŸ—“οΈ `not`: planned for objects
- βœ… `required`: non-required properties are turned to `Union[None, $type]`
- `additionalProperties`:
- βœ… boolean: supported as pydantic `extra: 'allow'` or `'forbid'`
- πŸ—“οΈ schema: planned as a `Mapping` field
- πŸ—“οΈ `patternProperties`: planned as `Mapping` field
- πŸ” `enum`: ignored; might be implemented for simple types as `Literal`
- πŸ“„ `description`: planned as part of docstr
- βœ… `default`: if present, the property type turned to `Union[None, $type]` and has default value `None`
- πŸ” caveat: default values are not to be sent between Web API client and server, instead they are implied be the receiving side. Lapidary could potentially fill such values in response models, but it might be expensive, so it would be an optional feature.
- βœ… `nullable`: if true, the property type is turned to `Union[None, $type]`
- βœ… `readOnly` & `writeOnly`: if either is true, the property type is turned to `Union[None, $type]` and has default value `None`; planned as part of docstr
- ⚠️ caveat: readOnly properties are only to be sent to API server, and writeOnly only to be received by the client. A property might be both required one way, and invalid the other way, which could not be directly represented in Python, except with two or three classes for every schema.
- ❌ `discriminator`: ignored
- πŸ” `example`: might be used as part of docstr
- πŸ—“οΈ `externalDocs`: planned as part of docstr
- πŸ—“οΈ `deprecated`: planned
- ❌ `xml`: ignored, currently not planned
- `responses`
- πŸ—“οΈ `description`: planned as part of docstr
- βœ… `headers`: if present, used as fields in the response envelope class
- βœ… `content`: implemented; used as operation method return type, and a way to resolve model type for a response
- πŸ” `links`: ignored; might be used to generate methods in the response envelope
- βœ… `parameters`: used in-line in operations
- πŸ” `examples`: currently ignored
- `requestBodies`
- πŸ—“οΈ `description`: planned as part of docstr
- βœ… `content`: implemented
- πŸ—“οΈ `required`: planned
- βœ… `headers`: implemented
- ⚠️ `securitySchemes`: implemented with httpx_auth
- ❌ `refreshUrl`: not supported
- πŸ—“οΈ `links`: planned
- ❌ `callbacks`: not planned
- `paths`
- πŸ—“οΈ `summary`, `description`: planned as parts of docstr
- ❌ `servers`: ignored
- `parameters`
- βœ… `name`: OpenAPI parameter names are not unique and might contain characters invalid for python names, therefore they're escaped and suffix-hungarian notation is used to distinguish between cookie, header, path and query parameters
- βœ… `in`: implemented, suffix-hungarian notation is used to separate parameters
- βœ… `required`: non-required parameters are optional with default value `None`
- πŸ—“οΈ `deprecated`: planned
- πŸ—“οΈ `allowEmptyValue`: planned
- πŸ—“οΈ `content`: key: planned, value: processed as schema
- ⚠️ `style`: partially implemented
- πŸ—“οΈ `allowReserved`: planned
- βœ… `schema`: implemented
- πŸ” `example` & examples: considered
- πŸ”§ `x-lapidary-name`: name of a parameter in the python
- πŸ”§ `x-lapidary-responses-global`: responses that might come from any operation
- πŸ”§ `x-lapidary-headers-global`: headers accepted by any operation

0 comments on commit d44003c

Please sign in to comment.