swagger: '2.0' info: description: 'This is an automatically generated REST API endpoint for the `<%= repoName %>` repository within the `<%= orgName %>` organization. For more information about ADDE, visit [adde.to/documentation](adde.to/documentation), or for information on Swagger, visit [http://swagger.io](http://swagger.io).' version: 1.0.0 title: <%= orgName %>/<%= repoName %> host: <%= domain %>:3000 basePath: /rest/<%= orgName %>/<%= repoName %> tags: <% endpoints.forEach(function(endpoint) { const pluralName = Object.keys(endpoint)[0]; %> - name: <%= pluralName %> description: Everything about your <%= pluralName %><% }); %> paths: <% endpoints.forEach(function(endpoint) { const pluralName = Object.keys(endpoint)[0]; const singularName = endpoint[pluralName].title; const propertyKeyNames = Object.keys(endpoint[pluralName].properties); %> /<%= pluralName %>: post: tags: - <%= pluralName %> summary: Add a new <%= singularName %> to the repository description: 'By POSTing data to this endpoint, ADDE will first validate that the token making the call has write access to the target repository. If it does, it will then validate the data being passed in is able to be validated successfully with the JSON Schema provided here http://<%= orgName %>.<%= repoName %>.adde.to/<%= pluralName %>/.schema.json. If so, it will add a new <%= singularName %> to the repository in a new commit on the master branch. If one with the same name already exists, the call will fail.' operationId: add<%= singularName %> consumes: - application/json produces: - application/json parameters: - in: body name: body description: <%= singularName %> object that needs to be added to the repository required: true schema: $ref: '#/definitions/<%= singularName %>' responses: '405': description: Invalid input security: - auth: - 'write:repository' - 'read:repository' get: tags: - <%= pluralName %> summary: Retrieves <%= pluralName %> (Optionally filtered by field values) description: 'By default, this endpoint will return an array of all <%= pluralName %>. You can optionally pass in field values for filtering the list down, provided via query string.' operationId: find<%= pluralName %>ByTags produces: - application/json parameters:<% propertyKeyNames.forEach(function(propertyName) { let type = endpoint[pluralName].properties[propertyName].type; if (type == "string" || type == "number") {%> - in: query name: <%= propertyName %> type: <%= endpoint[pluralName].properties[propertyName].type %><% }}); %> responses: '200': description: successful operation schema: type: array items: $ref: '#/definitions/<%= singularName %>' '400': description: Invalid tag value security: - auth: - 'read:repository' '/<%= pluralName %>/{id}': get: tags: - <%= pluralName %> summary: Find <%= singularName %> by ID description: Returns a single <%= singularName %> operationId: get<%= singularName %>ById produces: - application/json parameters: - name: id in: path description: ID of <%= singularName %> to return required: true type: integer format: int64 responses: '200': description: successful operation schema: $ref: '#/definitions/<%= singularName %>' '400': description: Invalid ID supplied '404': description: <%= singularName %> not found security: - auth: - 'read:repository' post: tags: - <%= pluralName %> summary: Updates an existing <%= singularName %> in the repository description: '' operationId: update<%= singularName %> consumes: - application/x-www-form-urlencoded produces: - application/json parameters: - name: id in: path description: ID of <%= singularName %> that needs to be updated required: true type: integer format: int64 - name: name in: formData description: Updated name of the <%= singularName %> required: false type: string - name: status in: formData description: Updated status of the <%= singularName %> required: false type: string responses: '405': description: Invalid input security: - auth: - 'write:repository' - 'read:repository' delete: tags: - <%= pluralName %> summary: Deletes a <%= singularName %> description: '' operationId: delete<%= singularName %> produces: - application/json parameters: - name: id in: path description: <%= singularName %> id to delete required: true type: integer format: int64 responses: '400': description: Invalid ID supplied '404': description: <%= singularName %> not found security: - auth: - 'write:repository' - 'read:repository'<% }); %> externalDocs: description: <%= orgName %>/<%= repoName %> Repository url: 'https://github.com/<%= orgName %>/<%= repoName %>'