Skip to content

feat(oas:sync): support x-internal, apply-tag-changes and apply-endpoint-order - #52

Merged
gkoberger merged 4 commits into
mainfrom
oas-sync-extensions
Sep 25, 2026
Merged

gkoberger merged 4 commits into
mainfrom
oas-sync-extensions

Conversation

@gkoberger

Copy link
Copy Markdown
Contributor

Mirrors how the platform (gitto's APIDefinition handler) applies these extensions when an API definition is resynced:

  • x-internal: operation-level value wins over root. When present it sets hidden on new and existing pages in both directions; when absent, existing pages keep their own hidden. A tag page is hidden once every operation in it is internal, and is never unhidden by sync.
  • apply-tag-changes (root, strict true): existing operation pages inside the API's category move to their current tag's folder (hand-moved pages in another category are left alone), tag page title/excerpt follow the spec, and emptied tag folders are deleted when generated or flattened to <tag>.md when hand-edited.
  • apply-endpoint-order (root, strict true): each folder's _order.yaml is reordered to spec order, refilling only the slots this API's pages already hold (gitto's applyOASOrder). Files never move.

oas:sync is no longer create-only; moves and frontmatter/order updates are reported as "Moved" / "Updated".

Also adds an oas-reference lint warning for x-readme: { internal }, which the oas package documents but the platform's page sync ignores.

🚥 Resolves ISSUE_ID

🧰 Changes

Describe in detail what this PR is for.

🧬 QA & Testing

Provide as much information as you can on how to test what you've done.

gkoberger and others added 2 commits September 23, 2026 16:08
…int-order

Mirrors how the platform (gitto's APIDefinition handler) applies these
extensions when an API definition is resynced:

- x-internal: operation-level value wins over root. When present it sets
  `hidden` on new and existing pages in both directions; when absent,
  existing pages keep their own `hidden`. A tag page is hidden once every
  operation in it is internal, and is never unhidden by sync.
- apply-tag-changes (root, strict `true`): existing operation pages inside
  the API's category move to their current tag's folder (hand-moved pages
  in another category are left alone), tag page title/excerpt follow the
  spec, and emptied tag folders are deleted when generated or flattened to
  `<tag>.md` when hand-edited.
- apply-endpoint-order (root, strict `true`): each folder's `_order.yaml`
  is reordered to spec order, refilling only the slots this API's pages
  already hold (gitto's applyOASOrder). Files never move.

oas:sync is no longer create-only; moves and frontmatter/order updates are
reported as "Moved" / "Updated".

Also adds an oas-reference lint warning for `x-readme: { internal }`, which
the `oas` package documents but the platform's page sync ignores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the conflict with #49 (GitHub Action) in oas:sync's run():
keeps main's printSyncResults()/writeGithubActionsOutputs() structure and
fail-on-skip behavior, adding the moved/updated totals to its summary.
Adds moved-count and updated-count Action outputs, and rebuilds dist-gha.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Adds OpenAPI spec features for visibility and ordering.

The PR appears safe to merge.

Reviews (3) · Last reviewed commit: "fix(oas:sync): only treat a tag page's e..."

Comment thread src/commands/oas-sync.js Outdated
Comment thread src/validators/oas-reference.js
Comment thread src/commands/oas-sync.js
Comment thread src/commands/oas-sync.js
… --fix and reporting

- Recognize a generated tag page by its shape alone rather than comparing
  its excerpt to the current spec's tags; once a tag leaves the spec there
  is nothing to compare against, and the page was being flattened into a
  stale <tag>.md instead of deleted.
- Only run the sync from lint --fix when at least one finding is fixable.
- Collapse duplicate _order.yaml entries before refilling slots so
  apply-endpoint-order never writes "- undefined".
- Report a file in "updated" once even when two passes touch it.
- Rebuild dist-gha.
Comment thread src/commands/oas-sync.js Outdated
…spec still supplies that text

An excerpt-only edit to a tag page was being deleted along with its
emptied folder. Nothing records what a page was generated from, so the
excerpt is now accepted as generated only when the current spec supplies
that exact text under some tag's description — which covers the common
retag, a rename that keeps its description. Anything else is treated as a
possible edit and the page is flattened, never deleted.
@gkoberger
gkoberger merged commit ae52d55 into main Sep 25, 2026
5 checks passed
@gkoberger
gkoberger deleted the oas-sync-extensions branch September 25, 2026 20:19
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.

1 participant