openapi: 3.0.0 info: title: API.Produto description: '' version: 1.0.0 termsOfService: 'http://swagger.io/terms/' servers: - url: 'http://127.0.0.1:8000/api/v1' description: Sandbox paths: /products: get: tags: - Product summary: Retorna os produtos. responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/products" '405': description: Método não permitido. content: application/json: schema: $ref: "#/components/schemas/error" '404': description: Recurso nõ encontrado. content: application/json: schema: $ref: "#/components/schemas/error" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. post: summary: Cadastrar produto. security: - bearerAuth: [] tags: - Product responses: '201': description: OK. content: application/json: schema: $ref: '#/components/schemas/productStatus2x' '401': description: Não autorizado. '405': description: Método não permitido. content: application/json: schema: $ref: "#/components/schemas/error" '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/Product' /products/{productId}: parameters: - $ref: '#/components/parameters/productId' get: tags: - Product summary: Retorna produto pelo ID. responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/product" '404': description: Produto não encontrado. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. put: summary: Editar produto. security: - bearerAuth: [] tags: - Product responses: '200': description: OK. content: application/json: schema: $ref: '#/components/schemas/productStatus2x' '401': description: Não autorizado. '404': description: Produto não encontrado. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/Product' patch: summary: Editar dados do produto. security: - bearerAuth: [] tags: - Product responses: '200': description: OK. content: application/json: schema: $ref: '#/components/schemas/productStatus2x' '401': description: Não autorizado. '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/Product' delete: tags: - Product summary: Excluir produto. security: - bearerAuth: [] responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '404': description: Produto não encontrado. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. /products/q/{name}: get: parameters: - $ref: '#/components/parameters/q' tags: - Product summary: Pesquisar produto pelo nome. responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/product" '404': description: Produto não encontrado. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '405': description: Método não permitido. content: application/json: schema: $ref: "#/components/schemas/error" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. /products/{productId}/additionals: parameters: - $ref: '#/components/parameters/productId' post: summary: Inserir produto adicional em um produto. security: - bearerAuth: [] tags: - Product additional responses: '201': description: OK. content: application/json: schema: $ref: '#/components/schemas/productStatus2x' '401': description: Não autorizado. '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/ProductAdditional' /products/categories: post: summary: Cadastrar categoria do produto. security: - bearerAuth: [] tags: - Product Category responses: '201': description: OK. content: application/json: schema: $ref: '#/components/schemas/category' '401': description: Não autorizado. '405': description: Método não permitido. content: application/json: schema: $ref: "#/components/schemas/error" '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/Category' get: summary: Retornar todas as categorias do produto. security: - bearerAuth: [] tags: - Product Category responses: '200': description: OK. content: application/json: schema: type: array items: $ref: '#/components/schemas/ProductCategory' '401': description: Não autorizado. '404': description: Produto não encontrado. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '405': description: Método não permitido. content: application/json: schema: $ref: "#/components/schemas/error" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. /products/categories/{categoryId}: parameters: - $ref: '#/components/parameters/categoryId' get: summary: Retornar a categoria pelo ID. security: - bearerAuth: [] tags: - Product Category responses: '200': description: OK. content: application/json: schema: $ref: '#/components/schemas/ProductCategory' '401': description: Não autorizado. '404': description: Categoria não encontrada. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. put: summary: Atualizar categoria do produto. security: - bearerAuth: [] tags: - Product Category responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '401': description: Não autorizado. '404': description: Categoria não encontrada. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/Category' patch: summary: Atualizar categoria do produto. security: - bearerAuth: [] tags: - Product Category responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '401': description: Não autorizado. '404': description: Categoria não encontrada. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/Category' delete: summary: Excluir a categoria pelo ID. security: - bearerAuth: [] tags: - Product Category responses: '200': description: ok. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '401': description: Não autorizado. '404': description: Categoria não encontrada. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. /products/categories/q/{name}: get: security: - bearerAuth: [] parameters: - $ref: '#/components/parameters/q' tags: - Product Category summary: Pesquisar categoria pelo nome. responses: '200': description: OK. content: application/json: schema: $ref: '#/components/schemas/ProductCategory' '404': description: Categoria não encontrada. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '405': description: Método não permitido. content: application/json: schema: $ref: "#/components/schemas/error" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. /products/additionals/categories: post: summary: Cadastrar categoria do produto adicional. security: - bearerAuth: [] tags: - Product Additional Category responses: '201': description: OK. content: application/json: schema: $ref: '#/components/schemas/category' '401': description: Não autorizado. '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/Category' get: summary: Retornar todas as categorias dos produto adicionais. security: - bearerAuth: [] tags: - Product Additional Category responses: '200': description: OK. content: application/json: schema: type: array items: $ref: '#/components/schemas/ProductAdditionalCategory' '401': description: Não autorizado. '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. /products/additionals/categories/{categoryId}: parameters: - $ref: '#/components/parameters/categoryId' get: summary: Retornar a categoria pelo ID. security: - bearerAuth: [] tags: - Product Additional Category responses: '200': description: OK. content: application/json: schema: $ref: '#/components/schemas/ProductAdditionalCategory' '401': description: Não autorizado. '404': description: Categoria não encontrada. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. put: summary: Atualizar categoria. security: - bearerAuth: [] tags: - Product Additional Category responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '401': description: Não autorizado. '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/Category' patch: summary: Atualizar categoria. security: - bearerAuth: [] tags: - Product Additional Category responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '401': description: Não autorizado. '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/Category' delete: summary: Excluir a categoria pelo ID. security: - bearerAuth: [] tags: - Product Additional Category responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '401': description: Não autorizado. '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. /products/additionals/categories/q/{name}: get: security: - bearerAuth: [] parameters: - $ref: '#/components/parameters/q' tags: - Product Additional Category summary: Pesquisar categoria pelo nome. responses: '200': description: OK. content: application/json: schema: $ref: '#/components/schemas/ProductAdditionalCategory' '404': description: Categoria não encontrada. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '405': description: Método não permitido. content: application/json: schema: $ref: "#/components/schemas/error" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. /products/additionals: get: security: - bearerAuth: [] tags: - Product Additional summary: Retorna os produtos adicionais. responses: '200': description: OK. content: application/json: schema: type: array items: $ref: "#/components/schemas/ProductAdditional" '405': description: Método não permitido. content: application/json: schema: $ref: "#/components/schemas/error" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. post: security: - bearerAuth: [] summary: Cadastrar produto adicional. tags: - Product Additional responses: '201': description: OK. content: application/json: schema: $ref: '#/components/schemas/productAdditionalStatus2x' '401': description: Não autorizado. '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/ProductAdditional' /products/additionals/{productAdditionalId}: parameters: - $ref: '#/components/parameters/productAdditionalId' get: security: - bearerAuth: [] tags: - Product Additional summary: Retornar produto adicional pelo ID. responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/ProductAdditional" '404': description: Produto adicional não encontrado. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '405': description: Método não permitido. content: application/json: schema: $ref: "#/components/schemas/error" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. put: summary: Editar produto adicional. security: - bearerAuth: [] tags: - Product Additional responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '404': description: Produto não encontrado. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '401': description: Não autorizado. '422': description: Requisição com parâmetros inválidos. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/ProductAdditional' patch: summary: Editar dados do produto adicional. security: - bearerAuth: [] tags: - Product Additional responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '404': description: Produto não encontrado. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '401': description: Não autorizado. '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. requestBody: $ref: '#/components/requestBodies/Product' delete: tags: - Product Additional summary: Excluir produto. security: - bearerAuth: [] responses: '200': description: OK. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '404': description: Produto não encontrado. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '405': description: Método não permitido. content: application/json: schema: $ref: "#/components/schemas/error" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. /products/additionals/q/{name}: parameters: - $ref: '#/components/parameters/q' get: security: - bearerAuth: [] tags: - Product Additional summary: Retornar produto pelo nome. responses: '200': description: OK. content: application/json: schema: type: array items: $ref: "#/components/schemas/ProductAdditional" '404': description: Produto adicional não encontrado. content: application/json: schema: $ref: "#/components/schemas/errorMessage" '405': description: Método não permitido. content: application/json: schema: $ref: "#/components/schemas/error" '500': description: Erro interno do servidor (Internal Server Error). '502': description: Bad Gateway. '504': description: Gateway Time-Out. components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT parameters: productId: name: productId in: path required: true description: ID do produto. schema: type: string productAdditionalId: name: productAdditionalId in: path required: true description: ID do produto adicional. schema: type: string categoryId: name: categoryId in: path required: true description: ID da categoria. schema: type: string q: name: name in: path required: true description: Nome. schema: type: string requestBodies: Product: content: application/json: schema: type: object properties: status: type: boolean name: type: string price: type: number format: decimal product_category_id: type: integer ProductAdditional: content: application/json: schema: type: object properties: status: type: boolean name: type: string price: type: number format: decimal product_additional_category_id: type: integer Category: content: application/json: schema: type: object properties: status: type: boolean name: type: string schemas: products: type: array items: $ref: "#/components/schemas/product" product: type: object properties: id: type: integer name: type: string price: type: number format: decimal product_category_id: type: integer status: type: boolean created_at: type: string format: data updated_at: type: string format: data additionals: $ref: "#/components/schemas/additionals" category: $ref: "#/components/schemas/category" images: $ref: "#/components/schemas/images" additionals: type: array items: $ref: "#/components/schemas/additional" additional: type: object properties: id: type: integer name: type: string price: type: number format: decimal product_additional_category_id: type: integer created_at: type: string format: data updated_at: type: string format: data pivot: type: object properties: product_id: type: integer product_additional_id: type: integer ProductAdditional: type: object properties: id: type: integer name: type: string price: type: number format: decimal product_additional_category_id: type: integer created_at: type: string format: data updated_at: type: string format: data category: $ref: "#/components/schemas/category" products: type: array items: $ref: "#/components/schemas/productStatus2x" category: type: object properties: id: type: integer name: type: string status: type: boolean created_at: type: string format: data updated_at: type: string format: data images: type: array items: $ref: "#/components/schemas/image" image: type: object properties: id: type: integer product_id: type: integer created_at: type: string format: data updated_at: type: string format: data productStatus2x: type: object properties: status: type: boolean name: type: string price: type: number format: decimal product_category_id: type: integer id: type: integer created_at: type: string format: data updated_at: type: string format: data productAdditionalStatus2x: type: object properties: status: type: boolean name: type: string price: type: number format: decimal product_additional_category_id: type: integer id: type: integer created_at: type: string format: data updated_at: type: string format: data ProductCategory: type: object properties: status: type: boolean name: type: string created_at: type: string format: data updated_at: type: string format: data products: type: array items: type: object properties: id: type: integer name: type: string price: type: number format: decimal product_category_id: type: integer status: type: boolean created_at: type: string format: data updated_at: type: string format: data ProductAdditionalCategory: type: object properties: status: type: boolean name: type: string created_at: type: string format: data updated_at: type: string format: data additionals: type: array items: type: object properties: id: type: integer name: type: string price: type: number format: decimal product_additional_category_id: type: integer status: type: boolean created_at: type: string format: data updated_at: type: string format: data error: type: object properties: error: type: object properties: description: type: string messages: type: array items: type: string errorMessage: type: object properties: message: type: string errors: type: string