Skip to content

Commit

Permalink
chore(middleware): update swagger file to 1.52.0
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Jul 4, 2023
1 parent 0c93860 commit d6eeda3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 39 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);
38 changes: 1 addition & 37 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 @@ -101,15 +74,6 @@ directive:
Otherwise autorest groups operations by 'get' prefix
https://github.com/aeternity/ae_mdw/issues/1357
- from: openapi-document
where: $.components.schemas.Status.properties
transform: >
if ($doc.info.title === 'middleware') return $;
$.mdw_tx_index = { type: 'integer' };
reason: >
`mdw_tx_index` missed in definition of '/status' endpoint
https://github.com/aeternity/ae_mdw/pull/1427
- from: openapi-document
where: $.servers
transform: $ = []
Expand Down

0 comments on commit d6eeda3

Please sign in to comment.