This script fixes various problems in the generated spec by Directus's /server/specs/oas
endpoint. It makes the spec somewhat OAS 3.0 compatible so you are able to generate code with https://github.com/OpenAPITools/openapi-generator. This project has a CLI project which can be found at https://www.npmjs.com/package/@openapitools/openapi-generator-cli.
[...]#/components/x-metadata is missing
[...]#/components/definitions/Query is missing
components.definitions is unexpected