Example
use *;
use Serialize;
Result:
---
openapi: 3.0.3
info:
title: My super API
version: 0.0.0
tags:
- name: admin
description: Super admin methods
- name: internal
servers:
- url: "https://my.super.server.com/v1"
paths:
/test:
post:
security:
- basicAuth:
test_auth:
requestBody:
required: true
description: ""
content:
application/json:
schema:
$ref: "#/components/schemas/InModule"
responses:
200:
description: Ok
content:
application/json:
schema:
type: array
items:
type: string
"/hello/world/{paramTest}":
summary: Some test group of requests
description: Another test description
get:
tags:
- internal
summary: Small summary
description: Small description
responses:
200:
description: Ok
content:
application/json:
schema:
type: string
parameters:
- name: someParam
description: Test
in: query
schema:
type: integer
post:
tags:
- admin
requestBody:
required: true
description: Some interesting description
content:
application/json:
schema:
type: string
responses:
200:
description: Ok
content:
application/json:
schema:
$ref: "#/components/schemas/SuperResponse"
parameters:
- name: asd
in: header
required: true
schema:
type: string
- name: paramTest
in: path
required: true
schema:
type: string
- name: test
in: query
schema:
type: integer
- name: x-request-id
description: Test
in: header
required: true
schema:
type: string
components:
schemas:
InModule:
type: object
properties:
field:
type: string
second:
$ref: "#/components/schemas/Test"
required:
- field
- second
SuperResponse:
description: New type description
type: string
enum:
- test
- another
- yay
example: test
Test:
type: object
properties:
another_field:
nullable: true
type: string
required:
- another_field
securitySchemes:
ApiKeyAuth:
type: apiKey
in: query
name: X-API-KEY
basicAuth:
type: http
scheme: basic
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
test_auth:
type: apiKey
in: query
name: X-MY-SUPER-API