Git Product home page Git Product logo

Comments (13)

gregsdennis avatar gregsdennis commented on July 18, 2024 1

Oh! My bad. No, schema generation is still a thing. The codegen one is deprecated. I'm sorry. I misread that.

from json-everything.

gregsdennis avatar gregsdennis commented on July 18, 2024 1

Let me have a poke around and see what I can do.

from json-everything.

gregsdennis avatar gregsdennis commented on July 18, 2024 1

I've been able to add some support, but you'll have to provide the XML file. Something like this:

var config = new SchemaGeneratorConfiguration();
config.RegisterXmlCommentFile<TypeCommentedModel>("JsonSchema.Net.Generation.Tests.xml");

I have some more work to do, but it's functioning.

from json-everything.

gregsdennis avatar gregsdennis commented on July 18, 2024 1

For your reading pleasure: https://docs.json-everything.net/schema/schemagen/schema-generation/#xml-comment-support

from json-everything.

zlepper avatar zlepper commented on July 18, 2024 1

There is a couple of small errors in the docs i noticed when trying it:

  • The SchemaGenerationConfiguration is actually called SchemaGeneratorConfiguration
  • The method is called RegisterXmlCommentFile not RegisterXmlCommentsFile (Notice comment vs comments)

When doing local development, the working directory of the application tends to be slightly different from the actual application the ddls are at. Maybe consider adding an overload that basically looks like this:

public void RegisterXmlCommentFile<T>()
{
      RegisterXmlCommentFile<T>(typeof(T).Assembly.Location.Replace(".dll", ".xml"))
}

That should work for most common cases where the

        <GenerateDocumentationFile>true</GenerateDocumentationFile>

csproj setting is set, but still allow people to control it using the current method :)

But other than that, it works perfectly :D

from json-everything.

gregsdennis avatar gregsdennis commented on July 18, 2024 1

I've updated the docs and included your extension method until I publish another version. Thanks for the pointers.

from json-everything.

gregsdennis avatar gregsdennis commented on July 18, 2024

Hey there. Thanks for the idea, but I've decided to deprecate this library.

Please see the blog post for more info.

from json-everything.

zlepper avatar zlepper commented on July 18, 2024

Sorry if i'm being stupid here, but i just want to confirm that both JsonSchema.Net.CodeGeneration and JsonSchema.Net.Generation are being deprecated in favor of Corvus.JsonSchema, even though it only supports Json => C#?

I'm entirely understanding of that decision, i just want to make sure i haven't misunderstood something about Corvus.JsonSchema :)

from json-everything.

gregsdennis avatar gregsdennis commented on July 18, 2024

So... on to the request.

The XML comment data isn't provided via reflection, which is how the schema generation works. In order to get that, you'd have to also provide the XML documentation file (e.g. JsonSchema.Net.xml). For simple assembly references, that file is not typicall included.

For an example of this working, you can see my API documentation generation. There's a lot of code there to read the file and match up the comments to the code. It's not impossible...

from json-everything.

zlepper avatar zlepper commented on July 18, 2024

Yup, i know it's a PITA to grap even when the xml documentation file is generated. I have previously used https://github.com/RicoSuter/Namotion.Reflection to grap the documentation, however it's quite a big library if the only thing you are interested in is getting xml docs. Alternatively swashbuckle has some code also that might be easier to borrow/adapt: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/tree/master/src/Swashbuckle.AspNetCore.SwaggerGen/XmlComments

It is honestly impressive that MS still doesn't provide any build in way of getting this information directly in dotnet...

It's not impossible...

Just annoyingly difficult :D Which is exactly why i would love to push it to an external (To me) library :D

from json-everything.

zlepper avatar zlepper commented on July 18, 2024

Holy shit, that was fast :D

from json-everything.

gregsdennis avatar gregsdennis commented on July 18, 2024

For your purposes, you can probably make the parameterless an extension method.

I'll have a look at the docs tomorrow.

from json-everything.

zlepper avatar zlepper commented on July 18, 2024

For your purposes, you can probably make the parameterless an extension method.

I'll have a look at the docs tomorrow.

Yup, that's is exactly what i have done, i just wanted to suggest it to make it easier to people to use :)

Thank you so much for the fast turnaround time :)

from json-everything.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.