GooG2e
7 years agoNew Member
Need small help to beginner
Hello!
I only have started to user openapi 3.0 (I want to generate some code for server and client from it).
I have described some endpoints and want some feedback - may be I do something wrong or have better instruments for this or something other comments.
Thank you very much!
openapi: 3.0.2
info:
title: Euterpe Project
version: 1.0.0
definitions:
GameTemplate:
type: object
title: Represent game parameters
required:
- name
properties:
id:
description: game id
type: integer
format: int64
minimum: 1
name:
description: game name
type: string
minLength: 3
Error:
type: object
title: Represent eroor description
properties:
error_id:
description: error id
type: integer
format: int32
minimum: 1
error_desc:
description: Error description
type: string
GameTemplateArray:
type: array
title: Array of game templates
items:
$ref: '#/definitions/GameTemplate'
components:
responses:
ErrorResponse:
description: Error during execution
content:
application/json:
schema:
$ref: '#/definitions/Error'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
paths:
/gamestempl:
post:
summary: Adds new game template
security:
- bearerAuth: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/definitions/GameTemplate'
responses:
201:
description: Successfull created template
content:
application/json:
schema:
$ref: '#/definitions/GameTemplate'
403:
$ref: '#/components/responses/ErrorResponse'
422:
$ref: '#/components/responses/ErrorResponse'
get:
summary: Returns list of game templates
security:
- bearerAuth: []
responses:
200:
description: Successfull return list of templates
content:
application/json:
schema:
$ref: '#/definitions/GameTemplateArray'
403:
$ref: '#/components/responses/ErrorResponse'
422:
$ref: '#/components/responses/ErrorResponse'
put:
summary: Modifies game template
security:
- bearerAuth: []
responses:
200:
description: Successful modified game template
content:
application/json:
schema:
$ref: '#/definitions/GameTemplate'
403:
$ref: '#/components/responses/ErrorResponse'
422:
$ref: '#/components/responses/ErrorResponse'