Comments (13)
Oh! My bad. No, schema generation is still a thing. The codegen one is deprecated. I'm sorry. I misread that.
from json-everything.
Let me have a poke around and see what I can do.
from json-everything.
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.
For your reading pleasure: https://docs.json-everything.net/schema/schemagen/schema-generation/#xml-comment-support
from json-everything.
There is a couple of small errors in the docs i noticed when trying it:
- The
SchemaGenerationConfiguration
is actually calledSchemaGeneratorConfiguration
- The method is called
RegisterXmlCommentFile
notRegisterXmlCommentsFile
(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.
I've updated the docs and included your extension method until I publish another version. Thanks for the pointers.
from json-everything.
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.
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.
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.
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.
Holy shit, that was fast :D
from json-everything.
For your purposes, you can probably make the parameterless an extension method.
I'll have a look at the docs tomorrow.
from json-everything.
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)
- Extract data annotation attributes from JsonSchema.Net.Generation into separate project HOT 2
- Is there a way to do JSON validation that does case insensitive matching on property names? HOT 8
- Support language packs in schema playground
- sileo-featured.json
- How to export or save JsonSchema to plaintext? HOT 4
- How to write a JsonSchemaBuilder for a class that has a property of a class? HOT 4
- Schema generation doesn't work on site HOT 1
- maximum/minimum use decimal which do not parse certain many double "number" strings HOT 3
- `Json.Schema.JsonSchema.Evaluate` throws "`System.OverflowException`: Value was either too large or too small for a Decimal." HOT 4
- Get json data from only required properties based on the attributes set HOT 4
- Schema validation crashes with stack overflow HOT 12
- Patch Path Not Escaping Forward Slash HOT 6
- EvaluationResults default value shows up in Annotations when number out or range, but not on other situations HOT 3
- Performance vs Newtonsoft.Json.Schema HOT 6
- Pattern and PatternProperties keyword performance and security improvements HOT 3
- How to add a keyword before another one HOT 2
- Schema validation doesn't fill EvaluationResults with any Errors for anyOf HOT 3
- ValidateMetaSchema option not working
- Why is NullableAttribute needed for nullable properties HOT 3
- Peformance issue with certain type of schema HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-everything.