Skip to content

feat(acf): generate acf fields on openapi file#84

Merged
moon0326 merged 1 commit intomoon0326:mainfrom
TotomInc:feat/acf-support
Oct 23, 2025
Merged

feat(acf): generate acf fields on openapi file#84
moon0326 merged 1 commit intomoon0326:mainfrom
TotomInc:feat/acf-support

Conversation

@TotomInc
Copy link
Copy Markdown
Contributor

This PR adds support for Advanced Custom Fields (ACF) in the generated OpenAPI specification, making ACF fields discoverable and properly typed in the API documentation.

It makes it significantly easier to work with ACF fields through the REST API, especially when using typed API clients or automated code generation tools.

  • Automatic ACF detection: the plugin now automatically detects and includes ACF field schemas from WordPress REST API endpoints
  • Improved type safety: ACF schemas are normalized to ensure proper typing, with special handling for complex field types like clone fields and flexible content layouts

The integration fetches ACF schema information directly from WordPress REST API OPTIONS requests and merges it into the OpenAPI specification. This means:

  • ACF fields appear in the acf property of resources
  • Type definitions are accurate and match WordPress's native schema
  • Client code generators (like openapi-typescript and openapi-fetch) can create proper types for ACF fields
  • API consumers get full documentation of available ACF fields

About the technical changes:

  • Added new AddACFSchema filter class to handle schema augmentation
  • Extended Operation class to support ACF schema in request bodies
  • Integrated the new filter into the main schema generation flow

@moon0326
Copy link
Copy Markdown
Owner

Thank you so much @TotomInc This is looking great! I'll review it tomorrow 👍

Copy link
Copy Markdown
Owner

@moon0326 moon0326 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you! This is nice :)

@TotomInc
Copy link
Copy Markdown
Contributor Author

Amazing, feel free to merge it as I cannot. 🙂

@moon0326 moon0326 merged commit ac0832a into moon0326:main Oct 23, 2025
@moon0326
Copy link
Copy Markdown
Owner

Thanks! Merged @TotomInc I’ll release a new version very soon!

Thanks for this feature again.

@moon0326
Copy link
Copy Markdown
Owner

@TotomInc This has been released with 1.0.25

I've also made a small change. ACF integration is an optional feature and it can be turned on/off under Settings -> WP OpenAPI

Screenshot 2025-10-23 at 4 51 23 PM

@moon0326 moon0326 mentioned this pull request Oct 23, 2025
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.

2 participants