Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ljqx/odata-json-schema
Generate JSON Schemas with OData informations from OData $metadata.
https://github.com/ljqx/odata-json-schema
json-schema odata
Last synced: about 6 hours ago
JSON representation
Generate JSON Schemas with OData informations from OData $metadata.
- Host: GitHub
- URL: https://github.com/ljqx/odata-json-schema
- Owner: ljqx
- Created: 2019-02-20T10:43:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-03-18T06:58:34.000Z (over 5 years ago)
- Last Synced: 2024-11-08T21:36:39.283Z (10 days ago)
- Topics: json-schema, odata
- Language: JavaScript
- Size: 92.8 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# odata-json-schema
Generate JSON Schemas with OData informations from OData $metadata.
## Example
With [the $metadata of service used in OData Doc](https://services.odata.org/V4/TripPinService/$metadata), check `example` folder for the JSON Schemas generated.## Usage
```js
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,
});
```