Comments (14)
That's not currently supported, but I can add support for the JsonPropertyName
attribute to do this.
I've added #111 to track this.
from json-everything.
@bahaasamoudi I was wrong. Looks like I do support the JsonPropertyName
attribute already. See https://github.com/gregsdennis/json-everything/blob/master/JsonSchema.Generation.Tests/SchemaGenerationTests.cs#L152
from json-everything.
What is the JSON content (bodyString
)?
from json-everything.
this is bodyString without ActionSource
"{\r\n \"eventTime\": \"2021-05-19T12:41:32-05:00\"\r\n}"
this is bodyString with ActionSource
"{\r\n \"eventTime\": \"2021-05-19T12:41:32-05:00\",\r\n \"ActionSource\": \"email\"\r\n}"
from json-everything.
Note:
when build the schema manually everything work without any issues
Json.Schema.JsonSchema schema1 = new JsonSchemaBuilder().Properties( ( "ActionSource", new JsonSchemaBuilder() .Type(SchemaValueType.String) .MinLength(10) ) ) .Required("ActionSource");
from json-everything.
Please serialize the resulting schema and print it for me.
from json-everything.
Can You Please Tell me how can i serialize it ?
I mean all object or only specific object inside it ?
from json-everything.
Just with the serializer. Schemas are already serializable.
var json = JsonSerializer.Serialize(schema);
Then print json
.
from json-everything.
i found where is the problem,
i'm using [required] attribute of dotnet DataAnootations not Json.Schema.generation
I'm sorry for that
can i ask you a question before close the issue ?
in json i want to write "actionSource" (small letter) not "Actionsource" (capital letter) without impact the required validation attribute, how can i do it ?
from json-everything.
Thanks @gregsdennis
from json-everything.
Thanks @gregsdennis it's work,
i have a question, when i have DateTime property and pass it in postman like {"eventTime": "2021-05-19T12:41:32-05:00"}
the validation message is "Value is string but should be object"
how can i solve this problem ?
this is my class
public class BaseData { [Required] [JsonPropertyName("eventTime")] public DateTime EventTime { get; set; } }
from json-everything.
What does the schema look like?
from json-everything.
"{\"type\":\"object\",\"properties\":{\"eventTime\":{\"type\":\"object\",\"properties\":{}}},\"required\":[\"eventTime\"]}"
from json-everything.
Please open a bug issue for this. The system should handle that, but it seems I don't have a test for it, so it's not being checked.
from json-everything.
Related Issues (20)
- Support custom keywords in schema generation HOT 6
- Evaluate JsonRequired Attribute HOT 5
- Model with Nullable value type is invalid HOT 1
- Model is not valid when has integer value as string HOT 1
- that the custom metastructure could not be parsed HOT 4
- How to extend SchemaGenerator for DateTime HOT 7
- JsonSchema.NET DataValidation HOT 10
- Custom `IAttributeHandler` never called HOT 5
- Anchors naming of 2020 still following 2019 rules HOT 5
- Generating a Custom JSON Schema HOT 1
- ArgumentOutOfRangeException thrown when calling JsonSchema's Evaluate methods from multiple threads. HOT 3
- 2020-12 output incorrectly places annotations
- Nullable decimal type removes multipleOf HOT 1
- Boolean applicator keywords must be non-empty HOT 1
- Issues with rendering on docs site HOT 1
- Verified error reporting type HOT 18
- 'Required' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.RequiredAttribute' and 'Json.Schema.Generation.RequiredAttribute'? HOT 22
- Schema exception {"An item with the same key has already been added. Key: Child"} HOT 9
- Possibly wrong return type HOT 10
- Customizing the `format` generated for a field (without attributes) HOT 5
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.