Skip to content

refactor(core): split the swagger dev feature pruning into its own module - #9775

Closed
wangsijie wants to merge 1 commit into
wangsijie-share-identity-verified-assertionfrom
wangsijie-swagger-dev-feature-pruning
Closed

wangsijie wants to merge 1 commit into
wangsijie-share-identity-verified-assertionfrom
wangsijie-swagger-dev-feature-pruning

Conversation

@wangsijie

@wangsijie wangsijie commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Stack: based on #9774 → #9773. The feature, #9771, sits on top. Merge in that order.

Summary

utils/general.ts sat exactly at the 300-line max-lines limit, so there was no room for the response-header pruning the Account API step-up work needs. The dev-feature plumbing moves to utils/dev-feature.ts:

  • devFeatureSchemaExtension, removeDevFeatureParameters, and removeDevFeatureSchemaProperties move as they are.
  • removeDevFeatureResponseHeaders is new: it drops a response header marked with x-logto-dev-feature while the marker is still on it, and is called from assembleSwaggerDocument before removeDevFeatureSchemaProperties, which strips the marker from every record unconditionally.
  • general.test.ts gains the two cases for the new pruning, and the moved imports and tests point at the new module.

Nothing in the repository marks a response header yet, so the served documents are unchanged and no changeset is needed. This is plumbing: the header it hides is added by the Account API step-up change.

Part of LOG-14124.

Testing

Unit tests: the new pruning cases run with dev features both disabled and enabled, and assert that the internal marker never reaches the document.

Checklist

  • unit tests
  • necessary TSDoc comments

…dule

`general.ts` was at the 300-line `max-lines` limit, so the pruning of
`x-logto-dev-feature` marked document parts moves to `dev-feature.ts` together
with the marker itself. The module also gains `removeDevFeatureResponseHeaders`,
which drops a dev-marked response header while the marker is still present, and
is wired into `assembleSwaggerDocument` before the schema pruning that strips
every marker.

Nothing in the repository marks a response header yet, so the served documents
are unchanged; this is the plumbing the Account API step-up work needs to hide
its new header.

Amp-Thread-ID: https://ampcode.com/threads/T-01a14383-fded-744a-b90a-56f48926c865

Copy link
Copy Markdown
Contributor Author

Dropping this: it existed only to hide the new WWW-Authenticate response header from the served OpenAPI document, and the header is no longer described in the supplement at all. Its documentation will land with the release that makes the challenge unconditional, where the plumbing is not needed. The branch stays around in case we want the response-header pruning for something else later.

@wangsijie wangsijie closed this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Make it better size/l

Development

Successfully merging this pull request may close these issues.

1 participant