Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON-RPC Swagger UI - Open API #277

Closed
qertis opened this issue Nov 9, 2019 · 5 comments
Closed

JSON-RPC Swagger UI - Open API #277

qertis opened this issue Nov 9, 2019 · 5 comments

Comments

@qertis
Copy link
Member

qertis commented Nov 9, 2019

Продолжение перехода к Open API

Примеры конфига
OAI/OpenAPI-Specification#664 (comment)
OAI/OpenAPI-Specification#664 (comment)

express-openapi
https://github.com/kogosoftwarellc/open-api/tree/master/packages/express-openapi

@qertis

This comment has been minimized.

@qertis
Copy link
Member Author

qertis commented Nov 11, 2019

Сделал конфиг для двух методов ping и help

openapi: 3.0.0
info:
  version: 1.0.0
  title: Simple API
  description: A simple API to illustrate OpenAPI concepts

servers:
  - url: 0.0.0.0:9000

components:
  securitySchemes:
    BasicAuth:
      type: http
      scheme: digest
security:
  - BasicAuth: []

paths:
  /:
    get:
      description: Returns a list of artists 
      responses:
        '200':
          description: OK   

  /api/ping:
    post:
      operationId: example Ping
      deprecated: false
      summary: Example of JSON-RPC2 Post
      description: Example post using JSON-RPC params.
      tags: [JSONRPC]    
      parameters: []
      responses:
        '200':
          description: OK
      requestBody:
        content: 
          application/json: 
            schema: 
              type: object
              required:
                - method
                - id
                - jsonrpc
                - params
              properties:
                method:
                  type: string
                  default: ping
                  description: API method name
                id:
                  type: integer
                  default: 1
                  format: int32
                  description: Request ID
                jsonrpc:
                  type: string
                  default: '2.0'
                  description: JSON-RPC Version (2.0)
                params:
                  title: Parameters
                  type: object
                  required: [id]
                  properties:
                    id:
                      type: integer
                      default: 1,
                      description: A param to include
         
  /api/help:
    post:
      operationId: example Help
      deprecated: false
      summary: Example HELP
      description: Example HELP JSON-RPC params.
      tags: [JSONRPC]
      parameters: []
      responses:
        '200':
          description: Successful response
      requestBody:
        content: 
          application/json: 
            schema: 
              type: object
              required:
                - method
                - id
                - jsonrpc
                - params
              properties:
                method:
                  type: string
                  default: help
                  description: API method name
                id:
                  type: integer
                  default: 1
                  format: int32
                  description: Request ID
                jsonrpc:
                  type: string
                  default: '2.0'
                  description: JSON-RPC Version (2.0)
                params:
                  title: Parameters
                  type: object
                  required: [id]
                  properties:
                    id:
                      type: integer
                      default: 1,
                      description: A param to include
                 

Теперь надо сделать его автогенерацию

@qertis qertis changed the title JSON-RPC Swagger UI JSON-RPC Swagger UI - Open API Nov 11, 2019
@qertis

This comment has been minimized.

@qertis qertis added this to the Демо киоск milestone Nov 11, 2019
@qertis
Copy link
Member Author

qertis commented Nov 13, 2019

Генерация будет доступна по урлу /spec

@qertis
Copy link
Member Author

qertis commented Nov 13, 2019

сделал пакет https://www.npmjs.com/package/openapi-jsonrpc-jsdoc

@qertis qertis closed this as completed Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant