Update swagger files, separate v0 and v1, delete old file

The new v1 doesn't contain any API endpoints yet. We will add them later
when they are ready.
This commit is contained in:
Maikel Linke
2022-02-08 11:41:49 +11:00
parent 9d67606490
commit 8f5cb7bd91
5 changed files with 78 additions and 1542 deletions

View File

@@ -2,7 +2,7 @@
require 'swagger_helper'
describe 'api/v0/orders', type: :request do
describe 'api/v0/orders', swagger_doc: 'v0/swagger.yaml', type: :request do
path '/api/v0/orders' do
get('list orders') do
tags 'Orders'

View File

@@ -25,6 +25,13 @@ RSpec.configure do |config|
servers: [
{ url: "/" }
]
},
'v0/swagger.yaml' => {
openapi: '3.0.1',
info: {
title: 'API V0',
version: 'v0'
}
}
}

File diff suppressed because it is too large Load Diff

66
swagger/v0/swagger.yaml Normal file
View File

@@ -0,0 +1,66 @@
---
openapi: 3.0.1
info:
title: API V0
version: v0
paths:
"/api/v0/orders":
get:
summary: list orders
tags:
- Orders
parameters:
- name: X-Spree-Token
in: header
schema:
type: string
- name: q[distributor_id_eq]
in: query
required: false
description: Query orders for a specific distributor id.
schema:
type: string
- name: q[completed_at_gt]
in: query
required: false
description: Query orders completed after a date.
schema:
type: string
- name: q[completed_at_lt]
in: query
required: false
description: Query orders completed before a date.
schema:
type: string
- name: q[state_eq]
in: query
required: false
description: Query orders by order state, eg 'cart', 'complete'.
schema:
type: string
- name: q[payment_state_eq]
in: query
required: false
description: Query orders by order payment_state, eg 'balance_due', 'paid',
'failed'.
schema:
type: string
- name: q[email_cont]
in: query
required: false
description: Query orders where the order email contains a string.
schema:
type: string
- name: q[order_cycle_id_eq]
in: query
required: false
description: Query orders for a specific order_cycle id.
schema:
type: string
responses:
'200':
description: get orders
content:
application/json:
schema:
"$ref": "#/components/schemas/Order_Concise"

View File

@@ -1,132 +1,8 @@
---
openapi: 3.0.1
info:
title: The Open Food Network
description: |-
This spec is auto generated using the rswag gem. It is incomplete and not yet valid for openapi 3.0.1. Do not publish this. \
Some endpoints are public and require no authorization; others require authorization. Talk to us to get your credentials set up. \
Check out our repo! https://github.com/openfoodfoundation/openfoodnetwork
version: '0.1'
components:
securitySchemes:
api_key:
type: apiKey
name: X-Spree-Token
in: header
schemas:
Order_Concise:
type: object
properties:
id:
type: integer
number:
type: string
full_name:
type: string
email:
type: string
phone:
type: string
completed_at:
type: string
display_total:
type: string
show_path:
type: string
edit_path:
type: string
state:
type: string
payment_state:
type: string
shipment_state:
type: string
payments_path:
type: string
shipments_path:
type: string
ship_path:
type: string
ready_to_ship:
type: string
created_at:
type: string
distributor_name:
type: string
special_instructions:
type: string
payment_capture_path:
type: string
distributor:
type: object
properties:
id:
type: integer
order_cycle:
type: object
properties:
id:
type: integer
paths:
"/api/orders":
get:
summary: list orders
tags:
- Orders
parameters:
- name: X-Spree-Token
in: header
schema:
type: string
- name: q[distributor_id_eq]
in: query
required: false
description: Query orders for a specific distributor id.
schema:
type: string
- name: q[completed_at_gt]
in: query
required: false
description: Query orders completed after a date.
schema:
type: string
- name: q[completed_at_lt]
in: query
required: false
description: Query orders completed before a date.
schema:
type: string
- name: q[state_eq]
in: query
required: false
description: Query orders by order state, eg 'cart', 'complete'.
schema:
type: string
- name: q[payment_state_eq]
in: query
required: false
description: Query orders by order payment_state, eg 'balance_due', 'paid',
'failed'.
schema:
type: string
- name: q[email_cont]
in: query
required: false
description: Query orders where the order email contains a string.
schema:
type: string
- name: q[order_cycle_id_eq]
in: query
required: false
description: Query orders for a specific order_cycle id.
schema:
type: string
responses:
'200':
description: get orders
content:
application/json:
schema:
"$ref": "#/components/schemas/Order_Concise"
title: API V1
version: v1
paths: {}
servers:
- url: https://staging.katuma.org/api
- url: "/"