Skip to content

Commit

Permalink
Reorganize YAML
Browse files Browse the repository at this point in the history
  • Loading branch information
tolyo committed Sep 5, 2023
1 parent 6824552 commit b1f68cc
Show file tree
Hide file tree
Showing 24 changed files with 22 additions and 264 deletions.
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ db-rebuild: ## Reset the database
$(MAKE) db-downgrade
$(MAKE) db-update

build-api: ## Build OpenAPI
node node_modules/swagger-cli/swagger-cli.js bundle --dereference \
-o pkg/static/docs/api/openapi.json \
-t json \
-r openapi/openapi.yaml
validate-api: ## Validate api
npx @openapitools/openapi-generator-cli validate \
-i pkg/openapi.yaml \
--recommend

generate-api: ## Generate server bindings
generate-api: ## Generate server bindings, move model files, fix imports
npx @openapitools/openapi-generator-cli generate \
-i openapi/openapi.yaml \
-i pkg/openapi.yaml \
-g go-server \
-o pkg/rest \
--additional-properties=packageName=api \
Expand All @@ -57,4 +56,4 @@ generate-api: ## Generate server bindings

help:
grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sed -n 's/^\(.*\): \(.*\)##\(.*\)/\1\3/p'
| sed -n 's/^\(.*\): \(.*\)##\(.*\)/\1\3/p'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions openapi/openapi.yaml → pkg/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ components:
scheme: basic
paths:
/currencies:
$ref: ./paths/currencies_list.yaml
$ref: ./rest/api/currencies_list.yaml
/instruments:
$ref: paths/instruments_list.yaml
$ref: ./rest/api/instruments_list.yaml
/order_books/{instrument_name}:
$ref: paths/order_books.yaml
$ref: ./rest/api/order_books.yaml
/trades:
$ref: paths/trades_list.yaml
$ref: ./rest/api/trades_list.yaml
/trade_orders:
$ref: paths/trade_orders_list.yaml
$ref: ./rest/api/trade_orders_list.yaml
3 changes: 3 additions & 0 deletions pkg/rest/.openapi-generator-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
**/routers.go

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
Expand Down
2 changes: 1 addition & 1 deletion pkg/rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To see how to make this your own, look here:
[README](https://openapi-generator.tech)

- API version: 1.0.0
- Build date: 2023-09-05T22:09:37.812488+03:00[Europe/Riga]
- Build date: 2023-09-05T23:22:31.538915+03:00[Europe/Riga]


### Running the server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ get:
content:
application/json:
schema:
$ref: ../definitions/currency.yaml#/components/schemas/CurrencyList
$ref: ../../models/currency.yaml#/components/schemas/CurrencyList
"500":
description: Error
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ get:
content:
application/json:
schema:
$ref: ../definitions/instrument.yaml#/components/schemas/InstrumentList
$ref: ../../models/instrument.yaml#/components/schemas/InstrumentList
"500":
description: Error
36 changes: 0 additions & 36 deletions pkg/rest/api/model_instrument.go

This file was deleted.

36 changes: 0 additions & 36 deletions pkg/rest/api/model_order_book.go

This file was deleted.

26 changes: 0 additions & 26 deletions pkg/rest/api/model_price_volume.go

This file was deleted.

25 changes: 0 additions & 25 deletions pkg/rest/api/model_trade.go

This file was deleted.

33 changes: 0 additions & 33 deletions pkg/rest/api/model_trade_order.go

This file was deleted.

28 changes: 0 additions & 28 deletions pkg/rest/api/model_trade_order_side.go

This file was deleted.

29 changes: 0 additions & 29 deletions pkg/rest/api/model_trade_order_status.go

This file was deleted.

31 changes: 0 additions & 31 deletions pkg/rest/api/model_trade_order_time_in_force.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ get:
name: instrument_name
required: true
schema:
$ref: '../definitions/instrument.yaml#/components/schemas/InstrumentName'
$ref: '../../models/instrument.yaml#/components/schemas/InstrumentName'

responses:
"200":
description: order book
content:
application/json:
schema:
$ref: '../definitions/order_book.yaml#/components/schemas/OrderBook'
$ref: '../../models/order_book.yaml#/components/schemas/OrderBook'
"500":
description: Error
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ get:
content:
application/json:
schema:
$ref: ../definitions/trade_order.yaml#/components/schemas/TradeOrderList
$ref: ../../models/trade_order.yaml#/components/schemas/TradeOrderList
"500":
description: Error
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ get:
content:
application/json:
schema:
$ref: '../definitions/trade.yaml#/components/schemas/TradeList'
$ref: '../../models/trade.yaml#/components/schemas/TradeList'
"500":
description: Error

0 comments on commit b1f68cc

Please sign in to comment.