Native OpenAPI 3.2.0 Tag Object support (parent, summary, kind, externalDocs)#1077
Open
jeffreyvanhees wants to merge 3 commits intodedoc:mainfrom
Open
Native OpenAPI 3.2.0 Tag Object support (parent, summary, kind, externalDocs)#1077jeffreyvanhees wants to merge 3 commits intodedoc:mainfrom
jeffreyvanhees wants to merge 3 commits intodedoc:mainfrom
Conversation
Contributor
Author
|
Tests are failing because composer tries to install the oldest compatible versions of dependencies. Recent updates to Pest PHP and its dependencies now require PHP 8.2+ creating a conflict with the PHP 8.1 test configuration. |
Member
|
@jeffreyvanhees what do you think about how this PR fits/relates to newly introduced OpenAPI 3.2.0 tags that support child/parent relationships? |
Contributor
Author
Very nice! I'll update my PR to this when I have time :) |
Replace the Redoc x-tagGroups extension approach with spec-native OpenAPI 3.2.0 Tag Object fields: parent, summary, kind, externalDocs. - Add ExternalDocumentation class - Extend Tag with summary, parent, kind, externalDocs properties - Add summary, kind, externalDocsUrl, externalDocsDescription to Group attribute - Update AddDocumentTags to set native fields and auto-create parent tags - Remove AddTagGroups transformer (no longer needed) - Bump OAS version from 3.1.0 to 3.2.0 - Rewrite tests for native parent field assertions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for the native OpenAPI 3.2.0 Tag Object fields, giving you spec-compliant hierarchical tag grouping plus new metadata fields.
What changed
3.1.0to3.2.0parentfieldsummary,kind,externalDocsfields on tags (OAS 3.2.0 spec)Usage
Hierarchical grouping with
parentThis generates native
parentfields on the tag objects:{ "tags": [ { "name": "users", "parent": "User Management" }, { "name": "profiles", "parent": "User Management" }, { "name": "User Management" } ] }The
User Managementparent tag is auto-created if you don't define it yourself. If you want to add a description or other metadata to it, define it explicitly on any controller:Tag summary
A short summary, separate from the longer
description:Tag kind
Indicate whether a tag is for navigation or represents an API:
External documentation
Link to external docs for a tag:
Generates:
{ "tags": [{ "name": "Payments", "externalDocs": { "url": "https://docs.stripe.com", "description": "Stripe API reference" } }] }Combining everything
#[Group( name: 'Billing', description: 'Invoices, subscriptions and payment methods', summary: 'Billing APIs', weight: 1, parent: 'Commerce', kind: 'api', externalDocsUrl: 'https://example.com/billing-docs', externalDocsDescription: 'Billing developer guide', )] class BillingController {}Breaking changes
3.2.0. Tools that don't support 3.2.0 may not recognize the new tag fields.Backward compatibility
#[Group]attributes withoutparentare unaffectedsummary,kind,externalDocsUrl,externalDocsDescription) are all optional