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.
This commit is contained in:
mr.koi
2026-07-31 16:47:39 +08:00
parent ea93f09154
commit 454e6c51d7
56 changed files with 14506 additions and 491 deletions
+228
View File
@@ -0,0 +1,228 @@
{
"openapi": "3.1.0",
"info": {
"title": "Koi generated package verification",
"version": "1.0.0"
},
"paths": {
"/api/v1/accounts/{segments}": {
"post": {
"tags": ["accounts"],
"operationId": "create_account",
"parameters": [
{
"name": "segments",
"in": "path",
"required": true,
"style": "label",
"explode": true,
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"name": "fields",
"in": "query",
"style": "pipeDelimited",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"name": "session",
"in": "cookie",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Account"
}
}
}
},
"responses": {
"200": {
"description": "created",
"headers": {
"X-Request-Id": {
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Account"
}
}
}
}
}
}
},
"/api/v1/unions": {
"get": {
"tags": ["unions"],
"operationId": "get_union",
"responses": {
"200": {
"description": "union",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UnionEnvelope"
}
}
}
}
}
}
},
"/api/v1/download": {
"get": {
"tags": ["files"],
"operationId": "download_file",
"responses": {
"200": {
"description": "bytes",
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Account": {
"type": "object",
"required": [
"id",
"secret",
"display_name",
"settings"
],
"properties": {
"id": {
"type": "integer",
"readOnly": true
},
"secret": {
"type": "string",
"writeOnly": true,
"minLength": 8
},
"display_name": {
"type": [
"string",
"null"
]
},
"state": {
"$ref": "#/components/schemas/AccountState"
},
"settings": {
"$ref": "#/components/schemas/FlexibleSettings"
}
}
},
"AccountState": {
"type": "string",
"enum": [
"active",
"disabled"
],
"x-enumNames": [
"active",
"disabled"
]
},
"FlexibleSettings": {
"type": "object",
"required": [
"theme"
],
"properties": {
"theme": {
"type": "string"
}
},
"additionalProperties": {
"type": "integer"
}
},
"UnionEnvelope": {
"type": "object",
"required": [
"value",
"criteria"
],
"properties": {
"value": {
"$ref": "#/components/schemas/StringOrInteger"
},
"criteria": {
"$ref": "#/components/schemas/SearchCriteria"
}
}
},
"StringOrInteger": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"SearchCriteria": {
"anyOf": [
{
"title": "ByName",
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
}
}
},
{
"title": "ById",
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "integer"
}
}
}
]
}
}
}
}
+113
View File
@@ -0,0 +1,113 @@
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