Skip to content
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

Documentation for generated json file --json #1125

Closed
millsp opened this issue Nov 1, 2019 · 6 comments
Closed

Documentation for generated json file --json #1125

millsp opened this issue Nov 1, 2019 · 6 comments

Comments

@millsp
Copy link

millsp commented Nov 1, 2019

Is there a place where the codes & structure of the --json output are documented?

I need this to create a tool that can consume it.

@millsp millsp changed the title Documentation for generated doc json file --json Documentation for generated json file --json Nov 1, 2019
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Nov 1, 2019

#936 adds types for the output, they don't all have doc comments, but it's a lot better than what's currently available.

@millsp
Copy link
Author

millsp commented Nov 1, 2019

Ow, that is a great job you're doing. Thanks.

When do you think this will get merged?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Nov 1, 2019

I'm just waiting for Anthony to have another look at the most recent changes, should be merged after that. I'm not sure when he'll have the time though.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 12, 2020

v0.16.0 has a new export JSONOutput which types the outputted JSON.

The root symbol is JSONOutput.ProjectReflection

@Gerrit0 Gerrit0 closed this as completed Jan 12, 2020
@HHogg
Copy link

HHogg commented Jan 13, 2020

Thanks for this @Gerrit0, I've been following it for a few months so I'm happy to see it land.

A couple of questions I have after trying this out.

  • From what I understand, some reflections like those with kindStrings of "External module" and "Interfaces" have a property called children, but none of the exported reflection types have a property called children.

  • The DeclarationReflection model has a signatures property, but the exported DeclarationReflection type does not.

  • Please could you also clarify what type the root of the output JSON is. If I type it as JSONOutput.ProjectReflection I see a type error. Also the children property on the root of the output gets typed to any.

Conversion of type '{ "id": number; "name": string; "kind": number; "flags": {}; "originalName": string; "children": ({ "id": number; "name": string; "kind": number; "kindString": string; "flags": { "isExported": boolean; }; "originalName": string; "children": ({ ...; } | { ...; })[]; "groups": { ...; }[]; "sources": { ...; }[]; } | .....' to type 'ProjectReflection' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Types of property 'groups' are incompatible.
    Type '{ "title": string; "kind": number; "children": number[]; }[]' is not comparable to type 'ReflectionGroup[]'.
      Type '{ "title": string; "kind": number; "children": number[]; }' is missing the following properties from type 'ReflectionGroup': flags, name, idts(2352)

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 13, 2020

Thanks! I believe that was just missed, checking the types now. The error with groups also looks like a bug. I guess I should have added a test to ensure importing the JSON as the serialized type doesn't give an error. Fix later today :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants