Skip to content

Commit

Permalink
Merge pull request #1856 from aeternity/feature/remove-mdw-workarounds
Browse files Browse the repository at this point in the history
chore(middleware): update swagger file to 1.52.0
  • Loading branch information
davidyuk authored Jul 7, 2023
2 parents 0c93860 + b14fe12 commit 4ebd390
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 35 deletions.
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

0 comments on commit 4ebd390

Please sign in to comment.