Skip to content

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
merged 11 commits into from
Jan 21, 2025
Merged

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

merged 11 commits into from
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.

@igornast
Copy link
Contributor Author

igornast commented Jan 6, 2025

@vinceAmstoutz could you take a look here? 👀

@vinceAmstoutz vinceAmstoutz self-requested a review January 6, 2025 12:13
Copy link
Contributor

@vinceAmstoutz vinceAmstoutz left a comment

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

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 });

Copy link
Contributor Author

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

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>
@alanpoulain
Copy link
Member

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

@igornast
Copy link
Contributor Author

igornast commented Jan 10, 2025

@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.

@igornast
Copy link
Contributor Author

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

@alanpoulain
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.

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

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

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.

3 participants