Repository navigation
Conversation
…rty, do not copy it down.
|
Fixes #320 |
| obj['::circular'] = !!schema.circularReference; | ||
| obj['::type'] = 'object'; | ||
| // The description belongs to the property itself, not to each of its type options | ||
| obj['::title'] = schema.title || ''; |
There was a problem hiding this comment.
This looks like the fix here, but all those other changes don't look correct to me. If we are setting the title, I don't see why we wouldn't set all the other ones.
There was a problem hiding this comment.
Your example is for primitive type array but you are also changing the complex types handling, why?
That's what I'm asking.
There was a problem hiding this comment.
In #300 i had the very primitive type int.
I try to word it differently "why". The property "localized" has a description. It has sub properties, which can be direct, one of, any of. The description (and related texts) belong to it.
If number one of the 'one of' has a different description it should / would show that, not copy over the top level description. Same for other relationships.
There was a problem hiding this comment.
Let's take a step back. I'm just saying your example spec is just the primativetype path as the one with the issue. While I can fully believe other flows also have an issue, let's just focus on one of these in this PR. I propose let's solve the localize multiple type for privative types rather than trying to solve the one of or any of here, and handle them in a follow up PR if you need those fixed too
This is the best way to make sure I can review this and get it in. Rather than changing all of them and needing to reason about more than one flow at a time. Does that make sense?
|
Superseeded by #321, which handles the rendering only. |

If a pattern got into a one of it was not rendered. This change fixes the rendering.
Broken
Fixed
Example openapi file to show the problem:
{ "openapi": "3.1.0", "info": { "title": "Nullable object with patternProperties", "version": "1.0", "description": "The two request bodies differ only in the type of `localized`: `object` vs. `[\"object\", \"null\"]`. Both must show the `<pattern: [a-z]{2}>` key with its fields, and the description once, on `localized` itself." }, "paths": { "/object": { "post": { "summary": "localized: type object (reference, renders correctly)", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "localized": { "type": "object", "description": "Translations, keyed by language code.", "patternProperties": { "[a-z]{2}": { "$ref": "#/components/schemas/Translation" } } } } } } } }, "responses": { "204": { "description": "No content" } } } }, "/nullable-object": { "post": { "summary": "localized: type [object, null] (pattern key missing, description repeated on each option)", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "localized": { "type": ["object", "null"], "description": "Translations, keyed by language code.", "patternProperties": { "[a-z]{2}": { "$ref": "#/components/schemas/Translation" } } } } } } } }, "responses": { "204": { "description": "No content" } } } } }, "components": { "schemas": { "Translation": { "type": "object", "properties": { "subject": { "type": "string" }, "body": { "type": "string" } } } } } }