Module v31

Module v31 

Source
Expand description

OpenAPI 3.1 specification support

This module provides OpenAPI 3.1.0 specification generation with full JSON Schema 2020-12 support and webhook definitions.

§Key differences from OpenAPI 3.0

  • Full JSON Schema 2020-12 compatibility
  • Webhooks support at the root level
  • Nullable types use type arrays instead of nullable: true
  • Support for $ref with sibling keywords

§Example

use rustapi_openapi::v31::{OpenApi31Spec, Webhook};

let spec = OpenApi31Spec::new("My API", "1.0.0")
    .description("An example API")
    .webhook("orderPlaced", Webhook::with_summary("Order placed event"))
    .build();

Structs§

ApiInfo31
API information for OpenAPI 3.1
Callback
Callback definition
Components31
Components container (schemas, security schemes, etc.)
Contact
Contact information
Discriminator
Discriminator for polymorphism
Example
Example object
ExternalDocs
External documentation
ExternalDocumentation
External documentation
Header
Response header
JsonSchema2020
JSON Schema 2020-12 schema definition
License
License information
MediaTypeObject
Media type object
OAuthFlow
OAuth2 flow
OAuthFlows
OAuth2 flows
OpenApi31Spec
OpenAPI 3.1.0 specification
SchemaTransformer
Transformer for converting OpenAPI 3.0 schemas to 3.1
SecurityScheme
Security scheme definition
Server
Server definition
ServerVariable
Server variable
Tag
Tag for grouping operations
Webhook
Webhook definition for OpenAPI 3.1
WebhookOperation
Webhook operation (similar to path operation)
WebhookRequestBody
Request body for webhook
WebhookResponse
Webhook response
Xml
XML metadata

Enums§

AdditionalProperties
Additional properties can be a boolean or a schema
TypeArray
Type array for nullable types in JSON Schema 2020-12