项目作者: ljqx

项目描述 :
Generate JSON Schemas with OData informations from OData $metadata.
高级语言: JavaScript
项目地址: git://github.com/ljqx/odata-json-schema.git
创建时间: 2019-02-20T10:43:10Z
项目社区:https://github.com/ljqx/odata-json-schema

开源协议:

下载


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

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