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

3.1 enum support tutorial page #1727

Open
Nayte91 opened this issue Feb 23, 2023 · 2 comments
Open

3.1 enum support tutorial page #1727

Nayte91 opened this issue Feb 23, 2023 · 2 comments

Comments

@Nayte91
Copy link
Contributor

Nayte91 commented Feb 23, 2023

Hello, thank you for the work!

In the 3.1 release news, you said:

Finally after quite some time (this issue was opened in 2018!), we have support for Enums in OpenAPI, REST and GraphQL. Both Doctrine ORM and ODM have support for enums through enumType which is supported by API Platform 3.0. Alan added their support over OpenAPI and GraphQL.

I would like to know more about enums, is it related to this post https://les-tilleuls.coop/blog/exposez-vos-enums-avec-api-platform ?

I didn't found anything about how to expose PHP's enum in the actual APIP3.1 doc (I may be blind!), if there's not isn't a good idea to adapt/translate/implement the above blogpost in the doc? I may work on it (as I will implement it few times in a personal project), so I can totally do this, I just need to know of this is the right direction, and if it's needed.

Let me know,
Best regards,

@alanpoulain
Copy link
Member

Hello,
No it's not related to the post. It works out of the box: if you use an enum in your resource, it will be used for the OpenAPI and GraphQL schema. I don't think a documentation is necessary for this case.
If you want to expose your enum as a resource, then you can follow the blog post. maybe we can write a documentation about it in this case.

@Nayte91
Copy link
Contributor Author

Nayte91 commented Feb 24, 2023

No it's not related to the post. It works out of the box: if you use an enum in your resource, it will be used for the OpenAPI and GraphQL schema. I don't think a documentation is necessary for this case.

Ok, I don't understand what changed since 3.0 so ^^ and how it works, therefore I can't write any doc about this new feature :/

If you want to expose your enum as a resource, then you can follow the blog post. maybe we can write a documentation about it in this case.

Let's go for this, I'll propose a new page. PR will come!

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

No branches or pull requests

2 participants