docs(codegen): sync the docs with the config types
Summary
The @rtk-query/codegen-openapi
docs have drifted from the source of truth in src/types.ts. The config options block on
the docs page is currently malformed, and 10 of the 27 supported options are not documented
at all.
This issue tracks bringing the page back in sync and improving the package's inline API documentation. The first two items are small and already up as PRs; the last two need a convention decision first.
Current state
The options block on the code generation page
does not parse as valid TypeScript. Four fields (useEnumType, enumStyle,
outputRegexConstants, httpResolverOptions) sit outside any type, followed by a
stray closing brace:
export type EndpointOverrides = {
pattern: EndpointMatcher
} & AtLeastOneOf<{ ... }>
useEnumType?: boolean // <- orphaned
enumStyle?: 'union' | 'enum' | 'as-const'
outputRegexConstants?: boolean
httpResolverOptions?: SwaggerParser.HTTPResolverOptions
} // <- stray braceThis came from two changes landing on adjacent lines: #5135 and #5304.
Ten options are missing entirely: unionUndefined, encodePathParams,
encodeQueryParams, includeDefault, mergeReadWriteOnly, useUnknown,
esmExtensions, exportAllSchemas, and prettierConfigFile.
Inline API docs are sparse and inconsistently tagged. src/ has 3
@public tags and no
@internal tags across roughly 87 top-level
symbols, so there is no reliable signal for what is supported API versus an implementation
detail.
Plan
Tracked as sub-issues:
- #5369 - fix the malformed config options block (#5366)
- #5370 - document the remaining config options (#5367)
- #5371 - document the config option types in
src/types.ts - #5372 - JSDoc pass over the rest of
src/
Open questions
Version callouts. operationIdTransformer, enumStyle, EnumStyle,
OperationIdTransformer, and resolveOperationName are all marked
@since 2.3.0 on master, but the latest
release is 2.2.0. Should the docs flag these as unreleased, or wait until 2.3.0
ships?
Tagging convention. Would you accept @public + @since on exported symbols and
@internal on non-exported ones, applied consistently across src/? master
already uses @public/@since on three symbols, so this would extend an existing
pattern rather than introduce one. Happy to skip it if you would rather not commit to an API
surface contract for this package.
ChangeLog. ChangeLog.md stops at 1.2.0 - 2023-11-09, but 2.0.0,
2.1.0, and 2.2.0 have shipped since. Is a backfill wanted, or does
.release-it.json already cover release notes elsewhere?
Minor
resolveOperationName in src/generate.ts uses
{@linkcode operation.operationId}, which does
not resolve - operation is destructured inside the function body and is not in scope for
the doc comment.
Source: reduxjs/redux-toolkit