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

adding attribute examples #1699

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

natsuki-engr
Copy link

@natsuki-engr natsuki-engr commented Feb 4, 2025

  • faq
  • common techniques
  • cookbook

there could be more example codes...

Copy link
Collaborator

@DerManoMann DerManoMann left a comment

Choose a reason for hiding this comment

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

Good stuff! Could you just please rename the files to something more meaningful? For example server_xx.php

@natsuki-engr
Copy link
Author

@DerManoMann
Thanks for checking my PR!
In the faq, the annotation sample is shown as an example of "dummy class".
So I chose the filename "dummy_class_xx.php" - was that not appropriate?

The simplest solution to avoid this issue is to add a 'dummy' class to the docblock

Please let me know if my understanding is incorrect. 🙏

@DerManoMann
Copy link
Collaborator

My bad - yes, this is fine.

@@ -0,0 +1,18 @@
<?php

use OpenApi\Attributes as OAT;
Copy link
Contributor

@Kiina Kiina Feb 7, 2025

Choose a reason for hiding this comment

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

The other docs all use as OA, while here it's as OAT. If you imported OpenApi\Attributes\Tag as OAT; I would get where the T is coming from, but here it might be wrong and could lead to confusion?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I do that actually everywhere in the codebase to distinguish annotations from attributes.
Very useful for slow migration where you might use both at the same time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well nvm then, seems like halfway through the user guide it sometimes switches to OAT. Cookbook even has both right after another:

https://zircote.github.io/swagger-php/guide/cookbook.html#mostly-virtual-models

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, people seem to use both, but it would be good to settle on a consistent pattern in the docs, I think.

Copy link
Author

Choose a reason for hiding this comment

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

should make another PR converting OpenApi\Attributes as OA; to OpenApi\Attributes as OAT; or fix my PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, fix the PR. You can add more if you want to, too.

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.

4 participants