Skip to content
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

When the nullable parameter of property is true, add the title parameter #1472

Closed
wants to merge 2 commits into from

Conversation

LTaooo
Copy link

@LTaooo LTaooo commented Sep 1, 2023

@LTaooo LTaooo changed the title When the nullable attribute of the property is true, add the title at… When the nullable parameter of property is true, add the title parameter Sep 1, 2023
@@ -373,6 +373,9 @@ public function jsonSerialize()
} else {
$ref['nullable'] = $data->nullable;
}
if (isset($data->title) && $data->title !== $defaultValues['title']) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this violate the 3.1.0 spec? There is code a few lines above that explicitly allows summary and description next to $ref, but nothing more.

https://spec.openapis.org/oas/v3.1.0.html#schemaObject

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not to add title to $ref
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, interesting. I am not sure the specs do specify that sort of thing.
If it is valid do we need to handle other properties too apart from title?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, maybe the description and summary can also be included. Now they are added to ref

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could try but there are some changes needed:

  • update from master - I think I removed the defaultValue code
  • the logic to add the title needs to be in a 3.1.0 conditional path only

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't mean we cannot do this, just that there are some more changes required. Or are you doing a new PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not doing a new PR. Do you need to merge this PR? If you need, I will reopen it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's reopen. Those changes have to go 😔 bro the PR.
I should have some time in the next few days for some more detailed feedback.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thinks

@LTaooo LTaooo closed this Sep 14, 2023
@LTaooo LTaooo reopened this Sep 15, 2023
@DerManoMann
Copy link
Collaborator

Sorry, sometimes the simplest is to make the change myself. In #1487 I've changed the code slightly so all other properties are preserved.

Doesn't change a lot in the tests, not sure how that works in real life though. If you could give the PR a try that would be great.

@LTaooo
Copy link
Author

LTaooo commented Oct 17, 2023

Sorry, sometimes the simplest is to make the change myself. In #1487 I've changed the code slightly so all other properties are preserved.

Thank you very much. I tested it in my project, and it seems to be working fine.
image

@DerManoMann
Copy link
Collaborator

CLosing in favour of #1471 as that icludes the more generic handling of preserving properties.

Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants