-
Notifications
You must be signed in to change notification settings - Fork 107
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
Description for property in schema is not respected #291
Comments
Also, I tried to check how you handle it when properties are decorated with public class User
{
public int Age { get; set; }
[Description("This is Address1")]
public Address Address1 { get; set; }
[Description("This is Address2")]
public Address Address2 { get; set; }
} Expected result: {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"Age": {
"type": "integer"
},
"Address1": {
"description": "This is Address1",
"type": [
"object",
"null"
],
"properties": {
"Street": {
"type": [
"string",
"null"
]
}
},
"required": [
"Street"
]
},
"Address2": {
"$ref": "#/properties/Address1",
"description": "This is Address2",
}
},
"required": [
"Age",
"Address1",
"Address2"
]
} Actual result: {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"Age": {
"type": "integer"
},
"Address1": {
"description": "This is Address1",
"type": [
"object",
"null"
],
"properties": {
"Street": {
"type": [
"string",
"null"
]
}
},
"required": [
"Street"
]
},
"Address2": {
"description": "This is Address2",
"type": [
"object",
"null"
],
"properties": {
"Street": {
"type": [
"string",
"null"
]
}
},
"required": [
"Street"
]
}
},
"required": [
"Age",
"Address1",
"Address2"
]
} Why after using mentioned attribute |
Hi @JamesNK, any thoughts? |
Are there any updates? |
TLTR
It is impossible to set seperate descriptions for properties of the same type where one is described by
$ref
and also description for such propertie is not respected beside it is a valid case. You can find an example of such structure here: https://json-schema.org/learn/getting-started-step-by-step.html.Hi @JamesNK,
after our last conversation about reading comments from code and puting them in description fields of schema I was working on such feature in my application. I was doing something like this:
Expected result:
Actual result:
Altering description on
Address2
is also overriding description forAddress1
. Whats more, int the end description forAddress2
is not included. Is it expected bahaviour or bug? If is is expected how can I set seperate descriptions for both Addresses and also include the one that is correlated with property described by$ref
?The text was updated successfully, but these errors were encountered: