Files
mr.koi 454e6c51d7 Release 0.2.0
Complete OpenAPI 3.0/3.1 generation, diagnostics, lifecycle safety, enum and naming mappings, bilingual documentation, examples, and pub.dev release validation.
2026-07-31 16:47:39 +08:00

114 lines
2.4 KiB
YAML

openapi: 3.0.3
info:
title: OpenAPI 3.0 compatibility corpus
version: 1.0.0
servers:
- url: https://{environment}.example.test
variables:
environment:
default: api
enum:
- api
- staging
security:
- clientKey: []
paths:
/v1/animals/{id}:
get:
operationId: getAnimal
tags:
- animals
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
responses:
"200":
description: Animal
headers:
X-Request-Id:
schema:
type: string
content:
application/json:
schema:
$ref: "#/components/schemas/Pet"
"404":
description: Missing
content:
application/problem+json:
schema:
$ref: "#/components/schemas/Problem"
components:
securitySchemes:
clientKey:
type: apiKey
in: header
name: X-Client-Key
schemas:
Animal:
type: object
required:
- kind
properties:
kind:
type: string
nickname:
type: string
nullable: true
Cat:
allOf:
- $ref: "#/components/schemas/Animal"
- type: object
required:
- lives
properties:
kind:
type: string
enum:
- cat
lives:
type: integer
minimum: 1
maximum: 9
Dog:
allOf:
- $ref: "#/components/schemas/Animal"
- type: object
required:
- trained
properties:
kind:
type: string
enum:
- dog
trained:
type: boolean
Pet:
oneOf:
- $ref: "#/components/schemas/Cat"
- $ref: "#/components/schemas/Dog"
discriminator:
propertyName: kind
mapping:
cat: "#/components/schemas/Cat"
dog: "#/components/schemas/Dog"
Problem:
type: object
required:
- code
properties:
code:
type: string
enum:
- not_found
- forbidden
x-enum-varnames:
- notFound
- forbidden
detail:
type: string