odata-json-schema

0.0.10 • Public • Published

odata-json-schema

Generate JSON Schemas with OData informations from OData $metadata.

Example

With the $metadata of service used in OData Doc, check example folder for the JSON Schemas generated.

Usage

const { generateJSONSchema } = require('odata-json-schema')
 
generateJSONSchema('https://services.odata.org/V4/TripPinService', {
  dist: './dist',
  // most types are nullable, you may want to limit generated schema size by considering some of the types are by default nullable
  isByDefaultNullable(ref) {
    if (ref === 'Edm/String') {
      return true;
    }
    return !ref.startsWith('Edm');
  },
  // by default enum value is not generated into the schema, if you need it set this value to true
  withEnumValue: true,
});

Package Sidebar

Install

npm i odata-json-schema

Weekly Downloads

0

Version

0.0.10

License

MIT

Unpacked Size

186 kB

Total Files

48

Last publish

Collaborators

  • ljqx