Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add command line to convert files #24

Merged
merged 1 commit into from Jul 29, 2021

Conversation

diegotremper
Copy link

This PR introduces a command-line option to this package.

Thanks!

Copy link

@stephenlprice stephenlprice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the CLI functionality by installing the repo and then ran the following tests:

  • npm test 45 passing (all)
  • check that help messages work properly for the package and the convert command
  • tested the convert command in REPL using the basic example described in the README
const schema = {
   '$schema': 'http://json-schema.org/draft-04/schema#',
   type: ['string', 'null'],
   format: 'date-time',

const convert = require('@openapi-contrib/json-schema-to-openapi-schema');

(async () => {
   const convertedSchema = await convert(schema);
   console.log(convertedSchema);
})();

// returned
{ type: 'string', format: 'date-time', nullable: true }
};
  • converted the "basic" and "address" examples and verified they match the OpenAPI provided for each by using:
npx json-schema-to-openapi-schema convert address/json-schema.json > address/address-oas.json

Everything looks good to me, I would just correct the one typo described in the comment and approve

],
"convert": [
"Converts JSON Schema Draft 04 to OpenAPI 3.0 Schema Object.",
"Returns a non-zero exit code if convertion fails.",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested both help messages and everything looks good. Just found one typo: "convertion" should be corrected to "conversion".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I fixed this issue and amend the latest commit. Thanks!

@philsturgeon philsturgeon merged commit b0df26e into openapi-contrib:master Jul 29, 2021
@github-actions
Copy link

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@philsturgeon
Copy link
Member

philsturgeon commented Jul 29, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants