1

I'm looking for an efficient tool (if possible in Node JS) that could convert a YAML file extracted from swagger to a JSON SCHEMA or a typescript interface. Until now the only working way I found was:

YAML->RAML->JSON SCHEMA->TYPESCRIPT interface

STEP1: YAML to RAML

only via this website. No easy to use libraries found... https://apimatic.io/transformer

STEP2: RAML TO JSON SCHEMA

I found and tested this library https://github.com/raml-org/ramldt2jsonschema

STEP3: JSON SCHEMA TO TYPESCRIPT interface

I found and tested this library https://www.npmjs.com/package/json-schema-to-typescript

If you know a better tool for doing it, please let me know. Because it can work if you have two or three models you want to validate, but it could be boring in case of 500 different models.


Note: The goal here is not to take a simple JSON file nor a XML file but to be able to validate the correct received value format with JSON Schema or a Typescript interface

gronaz
  • 399
  • 4
  • 10

2 Answers2

0

For the first step, you can generate a NodeJS SDK from https://apimatic.io/CGaaS-Api and use the Transformer endpoints to convert between Swagger YAML and RAML as per your requirement. You'll find documentation and usage information for this SDK on the same URL provided.

0

I had a similar problem, so I created a Mule Application to solve this problem. It is meant for developers to use, running in Standalone Runtime in the background, processing RAML specs in a ZIP.

You can download the Deployable Archive here: Please provide any feedback you feel appropriate.

Enjoy!

Matthew
  • 21
  • 4