Conversation
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
|
Running ultrareview automatically — This PR rewrites core naming resolution (new qualified mode, context-stack qualification, config migration) across 151 files — a subtle bug would silently break generated SDK type names and public APIs, so a deep review is warranted.. I'll post findings when complete. |
There was a problem hiding this comment.
Ultrareview completed in 16m 35s
All reported issues were addressed across 151 files
Tip: instead of fixing issues one by one fix them all with cubic
Re-trigger cubic
1db692e to
c8d872a
Compare
c8d872a to
55a706c
Compare
There was a problem hiding this comment.
Not sure if you were ready for review but.. Qualified names can collide with each other and degrade to numeric suffixes. Foo.barBaz and FooBar.baz both qualify to FooBarBaz. Since the property and refName frames are consumed, the resolver has nothing left and emits FooBarBaz1/FooBarBaz2. Spec-growth test: with only Foo.barBaz you get FooBarBaz, then adding FooBar.baz renames it to FooBarBaz1. That is exactly the instability this mode exists to remove, and under shortest these never conflict (BarBaz/Baz). Rare, but it should be documented as a known limitation or handled, e.g. fall back to shortest for both sides when two qualified names collide, rather than numbering.
If this isn't an issue let me know.
Please refer to sdk-gen-config PR#134 for the description of the new
nameResolutionflag strategy.This PR introduces a new "qualified" resolution mode to preemptively prevent name conflicts and ensure names stay stable as the spec grows
Unlike
shortest(formerly known asfixes.nameResolutionFeb2025), any inline schema (no$ref,title, orx-speakeasy-name-override) is systematically named after its property path from the nearest enclosing named schema , even in the absence of conflict:shortestqualifiedOrder.statusStatusOrderStatusOrder.settings.levelLevelOrderSettingsLevelOrder.tags[](array items)TagOrderTagOrder.file($reftoFileContent)FileContentFileContent(refs never prefixed)Under
shortest, adding a secondstatusproperty anywhere later renames the existingStatustype — a breaking change surfaced by unrelated spec edits. Underqualifiedthe name is already qualified, so it never moves.Not prefixed:
$refpropertiestitle/override-named schemasRedundant.redundantStatusstaysRedundantStatus).A conflict that still occurs (e.g. an actual component named like a qualified result) resolves reactively exactly as under
shortest.Structurally identical inline schemas shared by several parents split into per-parent types instead of merging into one bare-named, rename-prone type (stability over dedup); registration IDs already include the parent frame, so no dedup suppression was needed.
Implementation
qualifyInlineNameininternal/namer/namer.go, gated onNameResolutionAtLeast(qualified)in theGetTypeNamecontext-stack fallback:refNameframe; requires every frame between it and the leaf property frame to be part of a plain property chain (property,component,modelNamespace) — any operation/request/response/oneOf frame falls through to the existing behaviour;Order_settings_level);Explicit names (
$ref/title/override) return earlier inGetTypeName, so they are unaffected by construction. Field names are untouched (GetFieldNamepasses a nil stack).Test-config matrix
tests/confignow pinsnameResolutionexplicitly wherever the effective mode was previously implicit or expressed via the deprecated booleans:fixes.nameResolutionDec2023: falsenameResolution: legacyfixes.nameResolutionDec2023: falsenameResolution: qualifiedtrue/truenameResolution: shortest+ booleans keptDec2023: falselegacymode added, booleans kepttrue/trueshortestmode added, booleans keptnameResolution: legacyfixesblockNote on the last two rows:
Fixesuses a custom YAML unmarshaller that decodesinto a zero-value struct, so the presence of any
fixes:block wipes thenew-SDK defaults for every boolean not listed — which is why a block containing
only
securityFeb2025: truewas effectively runninglegacynaming. Theexplicit pins freeze the current behaviour instead of leaving it dependent on
new-SDK detection.
Summary by cubic
Adds a new
qualifiedname resolution mode that names inline schemas after their property path (e.g.,Order.settings.level→OrderSettingsLevel) to keep names stable as the spec grows. The deprecatedfixes.nameResolution*booleans are replaced by thenameResolutionconfig option.New Features
$ref,title, orx-speakeasy-name-overrideare now prefixed with the nearest enclosing named schema.$refproperties, and whole-document external refs that resolve to inline objects are not prefixed; an explicitly named inline schema becomes the naming root for its own children.Redundant.redundantStatusstaysRedundantStatusbutCard.cardinalityis not affected.Migration
fixes.nameResolutionFeb2025andfixes.nameResolutionDec2023withgeneration.nameResolution: legacy,shortest, orqualified.fixes:block wipes unlisted new-SDK defaults.qualified, renaming inline SDK types such asBasicAuth→AuthServiceRequestBodyBasicAuth.sdk-gen-configis bumped to v1.59.0 to support the new mode.Written for commit e9d0b74. Summary will update on new commits.