-
Notifications
You must be signed in to change notification settings - Fork 35
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
Can you implement JSON output of schema.d.ts file? #113
Comments
By JSON output, do you mean a https://json-schema.org/ definition of the Schema, or something else? |
Hi yes, that would be great. There is a lot of work done by you to generate schema.d.ts file. Why not also create a json object representation of the entire schema.d.ts file, so that we can use it in our projects such as creating ui components based on the json file. |
Hmm. There are separate libraries that create JSONschema for Schema.org as-is. They're useful especially if you have a .json file you want to represent as a specific SDO type. Is your use case different? Do you want JSONschema representing actual SDO JSON-LD? or JSONschema consumable by TypeDoc for documentation on the "schema-dts" types themselves (including WithContext, etc)? |
I pretty much want some what JSON-LD that I can loop over without having the reshape https://schema.org/version/latest/all-layers.jsonld. I know you guys created all the interfaces by extracting or converting https://schema.org/version/latest/all-layers.jsonld to ts-dts, I wanted to stick the way you shaped the interfaces and I wanted to be able to the use extractions the way you did, so I have full blown schema with its relations but again stick to the interfaces. So pretty much a json-ld representation of the schema.d.ts so I can create components based on the same relation in the schema.d.ts like in https://json-ld.org/#developers. Sorry I am having hard time to explain. |
What is SDO?
…Sent from my iPhone
On Jul 7, 2020, at 7:51 AM, Eyas <notifications@github.com> wrote:
Hmm. There are separate libraries that create JSONschema for Schema.org as-is. They're useful especially if you have a .json file you want to represent as a specific SDO type.
Is your use case different? Do you want JSONschema representing actual SDO JSON-LD? or JSONschema consumable by TypeDoc for documentation on the "schema-dts" types themselves (including WithContext, etc)?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#113 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMXYIUGAMEJ3NR67TJCBRZ3R2MY7BANCNFSM4ORAIEBA>.
|
Just a shorthand for "Schema.org" :)
|
@Eyas can you detail where those libraries are? My Google-fu is too weak to locate those projects. Personally, I'd have loved to have found a Typebox implementation of Schema.org types. I did try modifying transform.ts: import * as Codegen from '@sinclair/typebox-codegen';
// ...
for (const cls of sorted) {
if (cls.deprecated && !includeDeprecated) continue;
for (const node of cls.toNode(context, properties)) {
const result = printer.printNode(EmitHint.Unspecified, node, source);
// await write(result);
const code = Codegen.TypeScriptToTypeBox.Generate(result);
// const model = Codegen.TypeScriptToModel.Generate(result);
// const code = Codegen.ModelToJsonSchema.Generate(model); // This fails because the code generator needs the dependencies in scope
await write(code);
await write('\n');
}
await write('\n');
} This... Sorta worked. I was able to get a typebox file output from |
Such as
--options
Specify a json option file that should be loaded. If not specified TypeDoc will look for 'schema.json' in the current directory.
--json <path/to/output.json>
Specifies the location and file name a json file describing the project is written to. When specified no documentation will be generated.
https://github.com/TypeStrong/typedoc repository is an example of json output.
The text was updated successfully, but these errors were encountered: