-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REST: Replace abandoned
@apidevtools/swagger-cli
`@redocly/cli` is actively maintained, supports OpenAPI definition v3.1, and has better validation of OpenAPI schemas. Due to the way we dereference the schema with `redocly bundle` the resulting openapi.json file is approximately 7x bigger than before. Requires removing the `nullable` field from `data_type` in `PropertyValuePair` as it is now deprecated and the `openapi-response-validator` package doesn't support OpenAPI specification v3.1. This functionality should be reintroduced (via `"type": [ "string", "null" ]`) when all our tooling supports OpenAPI specification v3.1. Change-Id: Ib64971467a77eeadec82da85c204cc722a3c5121
- Loading branch information
1 parent
a58361c
commit efc40b0
Showing
11 changed files
with
44,632 additions
and
6,338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# This file instructs Redocly's linter to ignore the rules contained for specific parts of your API. | ||
# See https://redocly.com/docs/cli/ for more information. | ||
specs/resources/index.json: | ||
operation-4xx-response: | ||
- '#/~1openapi.json/get/responses' | ||
- '#/~1property-data-types/get/responses' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,23 @@ | ||
const SwaggerParser = require( '@apidevtools/swagger-parser' ); | ||
const { bundle, loadConfig } = require( '@redocly/openapi-core' ); | ||
const path = require( 'path' ); | ||
|
||
module.exports = function ( _ ) { | ||
const done = this.async(); | ||
|
||
this.addContextDependency( path.dirname( this.resourcePath ) ); | ||
|
||
SwaggerParser | ||
.dereference( | ||
this.resourcePath, | ||
{ | ||
resolve: { | ||
http: false | ||
} | ||
} | ||
) | ||
.then( ( spec ) => { | ||
const baseUrl = process.env.API_URL || 'https://wikibase.example/w/rest.php'; | ||
loadConfig( { configPath: 'redocly.yaml' } ) | ||
.then( ( config ) => { | ||
bundle( { ref: this.resourcePath, config, dereference: true } ) | ||
.then( ( result ) => { | ||
const baseUrl = process.env.API_URL || 'https://wikibase.example/w/rest.php'; | ||
|
||
done( null, JSON.stringify( { | ||
...spec, | ||
servers: [ { url: baseUrl + '/wikibase/v1' } ] | ||
} ) ) | ||
done( null, JSON.stringify( { | ||
...result.bundle.parsed, | ||
servers: [ { url: baseUrl + '/wikibase/v1' } ] | ||
} ) ); | ||
} ) | ||
.catch( ( { message } ) => done( message ) ); | ||
} ) | ||
.catch( ( { message } ) => done( message ) ); | ||
}; |
Oops, something went wrong.