-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Add JSON Schema Parser #28
Comments
Hello! Any updates now? |
Thank you for your comment. Sorry, I'm developing my other projects now. [local-data-api, py-data-api] However, This project is active. I'm going to develop the project this week again. If you want to support JSON schema then, I change a priority of this issue to high. |
Thanks for answer! I`m interesting in this project, i found it when search an any information about json schema parsers and code generators for pydantic. I will try to learn codebase and work about json schema parser. |
I guess the work may not hard, because of Json Schema, similar to OpenAPI. |
Firstly, i think about $ref fields, without it, it is easy. I checked readme and saw information what $ref supported only in 1 file, we should to "fix" that😊 |
I'm using https://github.com/wework/json-schema-to-openapi-schema and I haven't had any issues yet, though I'm probably not using all the features of JSON Schema. I use this script to run it from the command line: #! /usr/bin/env node
const fs = require('fs');
const minimist = require('minimist');
const path = require('path');
const toOpenApi = require('json-schema-to-openapi-schema');
const yaml = require('js-yaml');
function main(args) {
var argv = minimist(args);
try {
var json_schema = JSON.parse(fs.readFileSync(path.resolve(argv.input)));
}
catch (e) {
console.log(e);
return 1;
}
console.log(`JSON Schema read from ${argv.input}`);
const openapi = toOpenApi(json_schema);
try {
fs.writeFileSync(path.resolve(argv.output), yaml.dump(openapi));
}
catch (e) {
console.log(e);
return 1;
}
console.log(`OpenAPI written to ${argv.output}`);
return 0;
}
process.exit(main(process.argv.slice(2))); usage:
I haven't gotten around to submitting it yet :) |
Sry me, i was very busy in this week. I plan start work about it tomorrow. |
I implemented the feature. |
The code generator should handle json schema.
The way is to implement JSON Shema Parser.
The text was updated successfully, but these errors were encountered: