Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

docs(admin): openapi custom data provider example #2116

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

Merged
alanpoulain merged 11 commits into api-platform:4.0 from igornast:docs/admin/custom-dataprovider-example
Jan 21, 2025
Merged

docs(admin): openapi custom data provider example #2116

alanpoulain merged 11 commits into api-platform:4.0 from igornast:docs/admin/custom-dataprovider-example
Jan 21, 2025

Conversation

@igornast
Copy link
Contributor

@igornast igornast commented Jan 5, 2025

The pull request enhances the documentation for the Admin section by adding a comprehensive example of a custom dataProvider.

Goal:
To provide a more advanced, real-world example for developers who need to extend the OpenApiAdmin component with custom authentication and error handling.

Copy link
Contributor Author

igornast commented Jan 6, 2025

@vinceAmstoutz could you take a look here? 👀

vinceAmstoutz reacted with thumbs up emoji

Copy link
Member

@vinceAmstoutz vinceAmstoutz left a comment
edited
Loading

Choose a reason for hiding this comment

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

Thanks!

Sounds good to me @igornast except for a few minor changes. To be sure I'll ask people who know more about the API Platform front-end and admin components.

igornast and others added 2 commits January 7, 2025 14:34
Co-authored-by: Vincent Amstoutz <vincent.amstoutz@outlook.com>
Co-authored-by: Vincent Amstoutz <vincent.amstoutz@outlook.com>
admin/openapi.md Outdated

try {
const { status, headers, body, json } = await fetchUtils.fetchJson(url, options);
console.log('HTTP Response:', { status, headers, body, json });
Copy link
Member

@alanpoulain alanpoulain Jan 7, 2025

Choose a reason for hiding this comment

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

Suggested change
console.log('HTTP Response:', { status, headers, body, json });

igornast reacted with heart emoji
Copy link
Contributor Author

@igornast igornast Jan 7, 2025

Choose a reason for hiding this comment

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

@alanpoulain for the sake of example, we can even remove the whole try/catch clause. Maybe it makes more sense to keep it short here.

 [...]
 if (token) {
 options.user = { token: `Bearer ${token}`, authenticated: true };
 }
 
return await fetchUtils.fetchJson(url, options);
}

Copy link
Member

@alanpoulain alanpoulain Jan 7, 2025

Choose a reason for hiding this comment

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

Sure, it would be simpler!

Co-authored-by: Alan Poulain <contact@alanpoulain.eu>
Copy link
Member

Maybe it would be better to add it to the authentication support page, wouldn't it?

igornast reacted with eyes emoji

Copy link
Contributor Author

igornast commented Jan 10, 2025
edited
Loading

@alanpoulain just a quick update - I'm reviewing the authentication support page to see if there is a space for improvement by simplifying the example. I find the current version a bit hard to read and understand.

alanpoulain reacted with thumbs up emoji

Copy link
Contributor Author

@alanpoulain Please let me know if you find that structure readable and helpful. Comments and suggestions are welcome. :)

Copy link
Member

I think it could be improved, especially the JWT section (not shared with the Hydra part), but it's already an improvement, thank you.

igornast reacted with heart emoji

@alanpoulain alanpoulain merged commit 72f0db4 into api-platform:4.0 Jan 21, 2025
1 check passed
Copy link
Contributor Author

@alanpoulain @vinceAmstoutz many thanks for your support. 🚀 ❤️

vinceAmstoutz reacted with rocket emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vinceAmstoutz vinceAmstoutz vinceAmstoutz approved these changes

@alanpoulain alanpoulain alanpoulain approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /