fastify-openapi-glue
Version:
generate a fastify configuration from an openapi specification
526 lines (525 loc) • 9.43 kB
JSON
{
"openapi": "3.0.0",
"servers": [
{
"url": "http://localhost/v2"
}
],
"info": {
"title": "Test specification",
"description": "testing the fastify openapi glue",
"version": "0.1.0"
},
"security": [
{
"skipped": []
}
],
"paths": {
"/pathParam/{id}": {
"get": {
"operationId": "getPathParam",
"summary": "Test path parameters",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "ok"
}
}
}
},
"/queryParam": {
"get": {
"operationId": "getQueryParam",
"summary": "Test query parameters",
"parameters": [
{
"in": "query",
"name": "int1",
"schema": {
"type": "integer"
},
"required": true
},
{
"in": "query",
"name": "int2",
"schema": {
"type": "integer"
},
"required": true
}
],
"responses": {
"200": {
"description": "ok"
}
},
"x-tap-ok": true
}
},
"/queryParamObject": {
"get": {
"operationId": "getQueryParamObject",
"summary": "Test query parameters in an object",
"parameters": [
{
"in": "query",
"name": "obj",
"schema": {
"type": "object",
"properties": {
"int1": {
"type": "integer"
},
"int2": {
"type": "integer"
}
},
"required": ["int1", "int2"]
},
"required": true
}
],
"responses": {
"200": {
"description": "ok"
}
},
"x-tap-ok": true
}
},
"/queryParamArray": {
"get": {
"operationId": "getQueryParamArray",
"summary": "Test query parameters in an array",
"parameters": [
{
"in": "query",
"name": "arr",
"schema": {
"type": "array",
"items": {
"type": "integer"
}
},
"required": true
}
],
"responses": {
"200": {
"description": "ok"
}
},
"x-tap-ok": true
}
},
"/headerParam": {
"get": {
"operationId": "getHeaderParam",
"summary": "Test header parameters",
"parameters": [
{
"in": "header",
"name": "X-Request-ID",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "ok"
}
}
}
},
"/authHeaderParam": {
"get": {
"operationId": "getAuthHeaderParam",
"summary": "Test authorization header parameters",
"parameters": [
{
"in": "header",
"name": "authorization",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "ok"
}
}
}
},
"/bodyParam": {
"post": {
"operationId": "postBodyParam",
"summary": "Test body parameters",
"responses": {
"200": {
"description": "ok"
}
},
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/bodyObject"
}
}
},
"required": true
}
}
},
"/bodyParamWithoutContent": {
"post": {
"operationId": "postBodyParam",
"summary": "Test body parameters",
"responses": {
"200": {
"description": "ok"
}
},
"requestBody": {
"content": {},
"required": true
}
}
},
"/noParam": {
"get": {
"operationId": "getNoParam",
"summary": "Test without parameters",
"responses": {
"200": {
"description": "ok"
}
}
}
},
"/noOperationId/{id}": {
"get": {
"summary": "Test missing operationid",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/responseObject"
}
}
}
}
}
}
},
"/responses": {
"get": {
"operationId": "getResponse",
"summary": "Test response serialization",
"parameters": [
{
"in": "query",
"name": "replyType",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/responseObject"
}
}
}
}
}
}
},
"/operationSecurity": {
"get": {
"operationId": "testOperationSecurity",
"summary": "Test security handling OR functionality",
"security": [
{
"api_key": []
},
{
"skipped": []
},
{
"failing": []
}
],
"responses": {
"200": {
"description": "ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/responseObject"
}
}
}
},
"401": {
"description": "unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/errorObject"
}
}
}
}
}
}
},
"/operationSecurityUsingAnd": {
"get": {
"operationId": "testOperationSecurityUsingAnd",
"summary": "Test security handling AND functionality",
"security": [
{
"api_key": ["and"],
"skipped": ["works"]
}
],
"responses": {
"200": {
"description": "ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/responseObject"
}
}
}
},
"401": {
"description": "unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/errorObject"
}
}
}
}
}
}
},
"/operationSecurityWithParameter": {
"get": {
"operationId": "testOperationSecurityWithParameter",
"summary": "Test security handling",
"security": [
{
"api_key": []
},
{
"skipped": ["skipped"]
},
{
"failing": []
}
],
"responses": {
"200": {
"description": "ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/responseObject"
}
}
}
},
"401": {
"description": "unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/errorObject"
}
}
}
}
}
}
},
"/operationSecurityEmptyHandler": {
"get": {
"operationId": "testOperationSecurity",
"summary": "Test security handling",
"security": [
{},
{
"failing": []
}
],
"responses": {
"200": {
"description": "ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/responseObject"
}
}
}
},
"401": {
"description": "unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/errorObject"
}
}
}
}
}
}
},
"/operationSecurityOverrideWithNoSecurity": {
"get": {
"operationId": "testOperationSecurity",
"summary": "Test security handling",
"security": [],
"responses": {
"200": {
"description": "ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/responseObject"
}
}
}
}
}
}
},
"/operationWithFastifyConfigExtension": {
"get": {
"operationId": "operationWithFastifyConfigExtension",
"summary": "Test fastify config extension",
"x-fastify-config": {
"rawBody": true
},
"responses": {
"200": {
"description": "ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/responseObject"
}
}
}
}
}
}
},
"/ignoreRoute": {
"get": {
"operationId": "ignoreRoute",
"summary": "Test route correclty being ignored",
"x-no-fastify-config": true,
"responses": {
"200": {
"description": "ok"
}
}
}
},
"/emptyBodySchema": {
"get": {
"operationId": "emptyBodySchema",
"summary": "Empty body schema",
"responses": {
"204": {
"description": "Empty"
},
"302": {
"description": "Empty"
}
}
}
}
},
"components": {
"schemas": {
"bodyObject": {
"type": "object",
"additionalProperties": false,
"properties": {
"str1": {
"type": "string"
}
},
"required": ["str1"]
},
"responseObject": {
"type": "object",
"properties": {
"response": {
"type": "string"
}
},
"required": ["response"]
},
"errorObject": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"statusCode": {
"type": "integer"
}
}
}
},
"securitySchemes": {
"api_key": {
"type": "apiKey",
"in": "header",
"name": "X-API-Key"
},
"skipped": {
"type": "http",
"scheme": "basic"
}
}
}
}