Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(middleware): update swagger file to 1.52.0 #1856

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions tooling/autorest/middleware-prepare.mjs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

import { spawnSync } from 'child_process';

const run = (getOutput, command, ...args) => {
Expand All @@ -10,7 +12,8 @@ const run = (getOutput, command, ...args) => {
return stdout?.toString().trim();
};

const id = run(true, 'docker', 'create', 'aeternity/ae_mdw:1.51.0');
const openapi = '/home/aeternity/node/lib/ae_mdw-1.51.0/priv/static/swagger/swagger_v2.yaml';
const version = '1.52.0';
const id = run(true, 'docker', 'create', `aeternity/ae_mdw:${version}`);
const openapi = `/home/aeternity/node/lib/ae_mdw-${version}/priv/static/swagger/swagger_v2.yaml`;
run(false, 'docker', 'cp', `${id}:${openapi}`, './tooling/autorest/middleware-openapi.yaml');
run(false, 'docker', 'rm', '-v', id);
41 changes: 8 additions & 33 deletions tooling/autorest/middleware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,7 @@ directive:
reason: >
Schema violation: must NOT have additional properties (paths > /aex141 > get > parameters > 2)
additionalProperty: type
https://github.com/aeternity/ae_mdw/issues/1421

- from: openapi-document
where: $.paths.*.get.responses[?(@.schema)]
transform: >
if ($.content) throw new Error('Defined both schema and content');
$.content = { 'application/json': { schema: $.schema } };
delete $.schema;
reason: >
Schema violation: must NOT have additional properties
(paths > /aex141/{id} > get > responses > 400)
additionalProperty: schema
https://github.com/aeternity/ae_mdw/pull/1422
https://github.com/aeternity/ae_mdw/issues/1428

- from: openapi-document
where: $.components.schemas.Activity.properties.payload.oneOf
Expand All @@ -48,21 +36,6 @@ directive:
Error: modelProperties cannot be null or undefined in the mapper
https://github.com/Azure/autorest/issues/4118

- from: openapi-document
where: $.components.schemas.PaginatedResponse
transform: $.required = ['next', 'prev'];
reason: >
Required is missed on PaginatedResponse
https://github.com/aeternity/ae_mdw/pull/1426

- from: openapi-document
where: $.components.schemas
transform: "['NameClaimEvent'].forEach((name) => $[name].type = 'object')"
reason: >
The schema 'Activity' with an undefined type and declared properties is a bit ambiguous.
This has been auto-corrected to 'type:object'
https://github.com/aeternity/ae_mdw/pull/1424

- from: openapi-document
where: $.paths.*.get.responses.200.content.application/json.schema.allOf^
transform: $.type ??= 'object'
Expand Down Expand Up @@ -102,13 +75,15 @@ directive:
https://github.com/aeternity/ae_mdw/issues/1357

- from: openapi-document
where: $.components.schemas.Status.properties
where: $.paths./aex9/account-balances/{account_id}.get.responses.200.content.application/json.allOf^
transform: >
if ($doc.info.title === 'middleware') return $;
$.mdw_tx_index = { type: 'integer' };
$.schema = { allOf: $.allOf };
delete $.allOf;
reason: >
`mdw_tx_index` missed in definition of '/status' endpoint
https://github.com/aeternity/ae_mdw/pull/1427
Schema violation: must NOT have additional properties (paths >
/v2/aex9/account-balances/{account_id} > get > responses > 200 > content > application/json)
additionalProperty: allOf
https://github.com/aeternity/ae_mdw/pull/1437

- from: openapi-document
where: $.servers
Expand Down