Skip to content

feat: add contact and license to GenerateOpenApiDocumentOptions#157

Open
liorp wants to merge 1 commit into
mcampa:masterfrom
liorp:feat/info-contact-license
Open

feat: add contact and license to GenerateOpenApiDocumentOptions#157
liorp wants to merge 1 commit into
mcampa:masterfrom
liorp:feat/info-contact-license

Conversation

@liorp
Copy link
Copy Markdown

@liorp liorp commented Apr 18, 2026

Summary

Resolves #156.

Extends GenerateOpenApiDocumentOptions with optional contact and license fields that map 1:1 to the OpenAPI 3.x info sub-objects:

generateOpenApiDocument(appRouter, {
  title: 'My API',
  version: '1.0.0',
  baseUrl: 'https://api.example.com',
  contact: { name: 'Engineering', email: 'team@example.com', url: 'https://example.com' },
  license: { name: 'Apache-2.0' },
});

Changes

  • Added OpenApiContactObject and OpenApiLicenseObject interfaces (exported)
  • Added contact? and license? fields to GenerateOpenApiDocumentOptions
  • Passes them through to the info block in generateOpenApiDocument when provided
  • No breaking changes — both fields are optional

Why

Redocly and other OpenAPI linters warn when info.contact is absent (info-contact rule). Previously the only workaround was post-mutating the returned document, which pushes metadata that naturally belongs in the options object into imperative code.

Extends the info block options to include optional `contact` and
`license` fields, mapping 1:1 to the OpenAPI 3.x InfoObject sub-objects.
Eliminates the need for post-mutation workarounds to satisfy linters
(e.g. Redocly's info-contact rule).

Closes mcampa#156
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.

Add support for info.contact and info.license in GenerateOpenApiDocumentOptions

1 participant