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

Unable to generate C# types for GitHub's webhook schema #1392

Open
JamieMagee opened this issue Jul 29, 2021 · 2 comments
Open

Unable to generate C# types for GitHub's webhook schema #1392

JamieMagee opened this issue Jul 29, 2021 · 2 comments

Comments

@JamieMagee
Copy link

I'm attempting to generate C# types for GitHub's webhook schema. There is no official schema, but they have been generated here, and I am specifically attempting to use this file.

Using the following code:

var schema = await JsonSchema.FromUrlAsync("https://unpkg.com/@octokit/webhooks-schemas@4.2.1/schema.json");
var settings = new CSharpGeneratorSettings
{
    Namespace = "Octokit.Webhooks"
};
var generator = new CSharpGenerator(schema, settings);
var file = generator.GenerateFile()

I get this code, which is a subset of the types in the JSON schema definition.

The JSON schema definition is using draft 7, and I have seen #574, so I assume it might be something to do with that?

@RicoSuter
Copy link
Owner

RicoSuter commented Aug 5, 2021

I think the main problem is that oneOf inheritance is not yet supported - only OpenAPI's allOf, which works in the "other" direction - i.e. with all of you specify the schemas which inherit from "this" schema, with allOf you define the base schema.

Implementing this in a nice and not breaking way is not simple, I tried it already twice ;-)

#1295
#1266

@JamieMagee
Copy link
Author

Thanks for the explanation. Should I follow #13 for updates?

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

2 participants