Skip to content

Instantly share code, notes, and snippets.

@danzel
Created December 15, 2019 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danzel/b78c6e8daa1ef96470fac030d92e26ae to your computer and use it in GitHub Desktop.
Save danzel/b78c6e8daa1ef96470fac030d92e26ae to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.1",
"info": {
"title": "My API",
"version": "v1"
},
"paths": {
"/Test/Get": {
"get": {
"tags": [
"Test"
],
"operationId": "GetIt",
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/MyType"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/MyType"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/MyType"
}
}
}
}
}
}
},
"/Test/PostRequired": {
"post": {
"tags": [
"Test"
],
"operationId": "PostRequired",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MyType"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/MyType"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/MyType"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Success"
}
}
}
},
"/Test/PostNonRequired": {
"post": {
"tags": [
"Test"
],
"operationId": "PostNotRequired",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MyType"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/MyType"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/MyType"
}
}
}
},
"responses": {
"200": {
"description": "Success"
}
}
}
}
},
"components": {
"schemas": {
"MyInnerType": {
"type": "object",
"properties": {
"ignoreMe": {
"type": "integer",
"format": "int32"
}
}
},
"MyType": {
"required": [
"requiredInner",
"requiredInteger",
"requiredString"
],
"type": "object",
"properties": {
"requiredString": {
"type": "string"
},
"nonRequiredString": {
"type": "string",
"nullable": true
},
"requiredInteger": {
"type": "integer",
"format": "int32"
},
"nonRequiredInteger": {
"type": "integer",
"format": "int32",
"nullable": true
},
"requiredInner": {
"$ref": "#/components/schemas/MyInnerType"
},
"nonRequiredInner": {
"$ref": "#/components/schemas/MyInnerType",
"nullable": true
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment