Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBiesack committed Jan 19, 2024
1 parent de96127 commit 70bff49
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ Options:
--tokenUrl <tokenUrl> The tokenUrl for openIdConnect -> oauth2 transformation
-d, --delete-examples-with-id If set, delete any JSON Schema examples that have an `id` property
--oidc-to-oath2 <scopes> Convert openIdConnect security to oath2.
--convertJsonComments if used, convert `$comment` in JSON schemas
to `x-comment`. I omitted, simply delete
--convertJsonComments If used, convert `$comment` in JSON schemas
to `x-comment`. If omitted, delete
all `$comment` in JSON schemas.
(Use `--verbose` to log deletion
to stdout)
-s, --scopes <scopes> If set, this JSON/YAML file describes the OpenID scopes.
This is an alias for --oidc-to-oath2
-v, --verbose Verbose output
Expand Down Expand Up @@ -413,7 +415,7 @@ format: binary

## Unsupported down conversions

The tool does not support the following situations.
Curretnly, the tool does not support the following situations.
Contributions welcome!

* `openapi-down-convert` does not convert `exclusiveMinimum` and `exclusiveMaximum`
Expand All @@ -423,7 +425,7 @@ Contributions welcome!
* The tool only supports self-contained documents. It does not follow or resolve
external `$ref` documents embedded in the source document.
* Request body and response body `content` object transformations, such as
reversing `content: { 'application/octet-stream': {} }`
reversing `content: { 'application/octet-stream': {} }` as
described in [Migrating from OpenAPI 3.0 to 3.1.0](https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0)
* Converting other `contentEncoding` values (`7bit`, `8bit`, `binary`,
`quoted-printable`, `base16`, `base32`) (Note: `contentEncoding: base64` is supported by
Expand Down
13 changes: 7 additions & 6 deletions src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ export class Converter {
}

/**
* Log an rror message to console.error stream. Prefix the message string with `Error: `
* if it does not already have that text. Increments the `returnCode`.
* @param message parameters for console.warn
* Log an error message to `console.error` stream. Prefix the message string with `Error: `
* if it does not already start with `'Error'`. Increments the `returnCode`, causing
* the CLI to throw an Error when done.
* @param message parameters for `console.error`
*/
private error(...message) {
if (!message[0].startsWith('Error')) {
Expand Down Expand Up @@ -329,8 +330,8 @@ export class Converter {
* ```
* format: byte
* ```
* in `type: string` schemas. Warn if schema has a `format` already.
* and it is not `byte`
* in `type: string` schemas. It is an error if the schema has a `format` already
* and it is not `byte`.
*/
convertJsonSchemaContentEncoding() {
const schemaVisitor: SchemaVisitor = (schema: SchemaObject): SchemaObject => {
Expand All @@ -348,7 +349,7 @@ export class Converter {
} else {
delete schema['contentEncoding'];
schema['format'] = 'byte';
this.log(` converted schema: contentEncoding: base64 to format: byte`);
this.log(`Converted schema: 'contentEncoding: base64' to 'format: byte'`);
}
} else {
this.error(`Unable to down-convert contentEncoding: ${schema['contentEncoding']}`);
Expand Down

0 comments on commit 70bff49

Please sign in to comment.