openapi: 3.0.3 info: title: "{{ .AppName }}" version: "{{ .AppVersion }}" paths: /register: post: summary: Register new user tags: - Auth requestBody: content: application/json: schema: $ref: '#/components/schemas/UserRequest' required: true responses: "200": content: application/json: schema: $ref: '#/components/schemas/UserResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: user 'User' is already exists description: Bad request /login: post: summary: Login user (get JWT token) tags: - Auth requestBody: content: application/json: schema: $ref: '#/components/schemas/UserRequest' required: true responses: "200": content: application/json: schema: $ref: '#/components/schemas/UserLoginResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: No user with name 'User' description: Bad request /users: get: summary: Get all users tags: - Users responses: "200": content: application/json: schema: $ref: '#/components/schemas/GetAllUsersResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: no users description: Bad request /users/{id}: get: summary: Get user by id tags: - Users parameters: - name: id in: path description: ID of user required: true schema: type: integer format: int responses: "200": content: application/json: schema: $ref: '#/components/schemas/GetUserByIDResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: No user with id '1' description: Bad request put: summary: Update user by id tags: - Users parameters: - name: id in: path description: ID of user required: true schema: type: integer format: int requestBody: content: application/json: schema: $ref: '#/components/schemas/UpdateUserRequest' required: true responses: "200": content: application/json: schema: $ref: '#/components/schemas/UpdateUserByIDResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: No user with id '1' description: Bad request delete: summary: Delete user by id tags: - Users parameters: - name: id in: path description: ID of user required: true schema: type: integer format: int responses: "200": content: application/json: schema: $ref: '#/components/schemas/DeleteUserResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: No user with id '1' description: Bad request /notes: post: summary: Create new note security: - JWT: - write:notes - read:notes tags: - Notes requestBody: content: application/json: schema: $ref: '#/components/schemas/NoteRequest' required: true responses: "200": content: application/json: schema: $ref: '#/components/schemas/NoteResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: note 'Note' is already exists description: Bad request get: summary: Get all notes tags: - Notes security: - JWT: - write:notes - read:notes responses: "200": content: application/json: schema: $ref: '#/components/schemas/GetAllNotesResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: no notes description: Bad request /notes/{id}: get: summary: Get note by id tags: - Notes security: - JWT: - write:notes - read:notes parameters: - name: id in: path description: ID of note required: true schema: type: integer format: int responses: "200": content: application/json: schema: $ref: '#/components/schemas/GetNoteByIDResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: No note with id '1' description: Bad request put: summary: Update note by id tags: - Notes security: - JWT: - write:notes - read:notes parameters: - name: id in: path description: ID of note required: true schema: type: integer format: int requestBody: content: application/json: schema: $ref: '#/components/schemas/UpdateNoteRequest' required: true responses: "200": content: application/json: schema: $ref: '#/components/schemas/UpdateNoteByIDResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: No note with id '1' description: Bad request delete: summary: Delete note by id tags: - Notes security: - JWT: - write:notes - read:notes parameters: - name: id in: path description: ID of note required: true schema: type: integer format: int responses: "200": content: application/json: schema: $ref: '#/components/schemas/DeleteNoteResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: No note with id '1' description: Bad request /notes/{id}/tags/set: put: summary: Set tags to note tags: - Notes security: - JWT: - write:notes - read:notes parameters: - name: id in: path description: ID of note required: true schema: type: integer format: int - name: tag in: query description: ID of tag to set to note required: true explode: true schema: type: array items: type: string responses: "200": content: application/json: schema: $ref: '#/components/schemas/SetTagsToNote' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error1: No note with id '1' error2: No tag with id '1' error3: Tag 'tag' is already set description: Bad request /notes/{id}/tags/remove: put: summary: Remove tags from note tags: - Notes security: - JWT: - write:notes - read:notes parameters: - name: id in: path description: ID of note required: true schema: type: integer format: int - name: tag in: query description: ID of tag to remove from note required: true explode: true schema: type: array items: type: string responses: "200": content: application/json: schema: $ref: '#/components/schemas/RemoveTagsToNote' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error1: No note with id '1' error2: No tag with id '1' error3: Tag 'tag' is already set description: Bad request /allnotes/tags: get: summary: Get all notes with all tags by user tags: - Notes security: - JWT: - write:notes - read:notes responses: "200": content: application/json: schema: $ref: '#/components/schemas/GetAllNotesWithAllTags' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error1: No notes error2: No notes with tags description: Bad request /notes/{id}/tags: get: summary: Get note with all tags by user tags: - Notes security: - JWT: - write:notes - read:notes parameters: - name: id in: path description: ID of note required: true schema: type: integer format: int responses: "200": content: application/json: schema: $ref: '#/components/schemas/GetNoteWithAllTags' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error1: No notes error2: No notes with tags description: Bad request /tags: post: summary: Create new tag security: - JWT: - write:tags - read:tags tags: - Tags requestBody: content: application/json: schema: $ref: '#/components/schemas/TagRequest' required: true responses: "200": content: application/json: schema: $ref: '#/components/schemas/TagResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: tag 'Tag' is already exists description: Bad request get: summary: Get all tags tags: - Tags security: - JWT: - write:tags - read:tags responses: "200": content: application/json: schema: $ref: '#/components/schemas/GetAllTagsResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: no tags description: Bad request /tags/{id}: get: summary: Get tag by id tags: - Tags security: - JWT: - write:tags - read:tags parameters: - name: id in: path description: ID of tag required: true schema: type: integer format: int responses: "200": content: application/json: schema: $ref: '#/components/schemas/TagRequest' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: No tag with id '1' description: Bad request put: summary: Update tag by id tags: - Tags security: - JWT: - write:tags - read:tags parameters: - name: id in: path description: ID of tag required: true schema: type: integer format: int requestBody: content: application/json: schema: $ref: '#/components/schemas/TagRequest' required: true responses: "200": content: application/json: schema: $ref: '#/components/schemas/UpdateTagByIDResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: No tag with id '1' description: Bad request delete: summary: Delete tag by id tags: - Tags security: - JWT: - write:tags - read:tags parameters: - name: id in: path description: ID of tag required: true schema: type: integer format: int responses: "200": content: application/json: schema: $ref: '#/components/schemas/DeleteTagResponse' description: Success request "400": content: application/json: schema: $ref: '#/components/schemas/ResponseError' example: error: No tag with id '1' description: Bad request components: securitySchemes: JWT: type: apiKey name: Authorization in: header schemas: UserRequest: additionalProperties: false type: object properties: username: type: string password: type: string required: - username - password UpdateUserRequest: additionalProperties: false type: object properties: username: type: string password: type: string UserResponse: type: object properties: Created new user 'User' with id: type: string required: - Created new user 'User' with id ResponseError: type: object properties: error: type: string required: - error UserLoginResponse: type: object properties: token: type: string required: - token GetAllUsersResponse: type: array items: type: object properties: id: type: string username: type: string required: - id - username GetUserByIDResponse: type: object properties: id: type: string username: type: string required: - id - username UpdateUserByIDResponse: type: object properties: Updated user with id: type: string required: - Updated user with id DeleteUserResponse: type: object properties: Deleted user with id: type: string required: - Deleted user with id NoteRequest: type: object properties: title: type: string info: type: string required: - title - info NoteResponse: type: object properties: Created note 'Note' with id: type: string required: - Created note 'Note' with id GetAllNotesResponse: type: array items: type: object properties: id: type: string title: type: string info: type: string required: - id - title - info GetNoteByIDResponse: type: object properties: title: type: string info: type: string required: - title - info UpdateNoteRequest: type: object properties: title: type: string info: type: string UpdateNoteByIDResponse: type: object properties: Updated note with id: type: string required: - Updated note with id DeleteNoteResponse: type: object properties: Deleted note with id: type: string required: - Deleted note with id SetTagsToNote: type: object properties: To note 'Note' set tags: type: object properties: tag: type: string required: - tag required: - To note 'Note' set tags RemoveTagsToNote: type: object properties: From note 'Note' remove tags: type: object properties: tag: type: string required: - tag required: - From note 'Note' remove tags GetAllNotesWithAllTags: type: array items: type: object properties: id: type: string title: type: string info: type: string tags: type: array items: type: object properties: id: type: string tagname: type: string required: - id - tagname required: - id - title - info - tags GetNoteWithAllTags: type: object properties: id: type: string title: type: string info: type: string tags: type: array items: - type: object properties: id: type: string tagname: type: string required: - id - tagname required: - id - title - info - tags TagRequest: type: object properties: tagname: type: string required: - tagname TagResponse: type: object properties: Created tag 'Tag' with id: type: string required: - Created tag 'Tag' with id GetAllTagsResponse: type: array items: type: object properties: id: type: string tagname: type: string required: - id - tagname UpdateTagByIDResponse: type: object properties: Updated tag with id: type: string required: - Updated tag with id DeleteTagResponse: type: object properties: Deleted tag with id: type: string required: - Deleted tag with id