commits
The fixDanglingRefs() function was handling invalid OpenAPI/JSON Schema usage where external files use local-looking refs (e.g., #/components/schemas/SchemaB) to reference schemas in other external files.
Per JSON Schema and OpenAPI specifications, a ref starting with # is a local reference to the current document only. Cross-file references must use proper relative or absolute URIs.
Removed:
- fixDanglingRefs() function from bundle.ts
- Cross-file reference test case
- Test spec files: cross-file-ref-*.json
- Associated snapshot file
Invalid specs should fail with clear errors rather than being silently "fixed". Users with such specs should be asked to use correct syntax like "file2.json#/components/schemas/SchemaB".
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Only add file prefix to external schema names when there's a naming conflict. This results in cleaner schema names like "User" instead of "file1_User" when there's no ambiguity.
Changes:
- Modified remap() to try unprefixed names first
- Only add file prefix when the unprefixed name is already taken
- Updated fixDanglingRefs() to handle both prefixed and unprefixed names
- Updated test snapshots to reflect new cleaner naming
- Verified conflict resolution still works correctly
Example:
- No conflict: "SchemaA" (was "file1_SchemaA")
- With conflict: First gets "User", second gets "file2_User"
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Created expectBundledSchemaToMatchSnapshot() helper to eliminate repeated code in all 5 bundle tests. The helper handles:
- Creating output and snapshot paths
- Ensuring directory exists
- Writing bundled result to temp file
- Comparing with snapshot
This reduces duplication and makes tests more maintainable.
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Following the pattern from Zod v4 tests, convert bundle tests from value comparisons to snapshot testing for better visibility of bundled specs.
Changes:
- Added __snapshots__ directory with JSON snapshot files for each test
- Updated bundle.test.ts to use toMatchFileSnapshot matcher
- All 5 tests now write bundled output to temp directory and compare with snapshots
- Snapshots provide complete visibility of bundled spec structure
- Removed verbose assertion code, replaced with simple snapshot comparisons
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
When an external file references a schema from another external file using a local-looking ref (e.g., #/components/schemas/SchemaB), the bundle() function would:
1. Try to resolve it relative to the current file
2. Fail and log "Skipping unresolvable $ref"
3. Leave the ref as-is in the bundled output
4. Create a dangling reference since SchemaB is hoisted with a different name
Added fixDanglingRefs() post-processing step that:
- Identifies dangling internal $refs
- Matches them to hoisted schemas from other files
- Rewrites them to the correct hoisted names
Test case added: cross-file reference scenario
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
- Created test specs with YAML files mimicking Redfish structure
- Added comprehensive test for versioned schema names
- Verified sibling schemas are hoisted correctly with YAML
- All 4 bundle tests pass
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
- Created test specs with external files containing multiple schemas
- Added test case for sibling schema hoisting in bundle.test.ts
- All tests pass - sibling schemas are correctly hoisted
- Tested with local files, nested references, and HTTP URLs
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Add `patch.input` and shorthand `patch()` option for full specification transformations
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
chore(deps): update dependency dotenv to v17.3.1
chore(deps): update dependency turbo to v2.8.8
fix(shared): support non-string discriminator property types
refactor: zod plugin nullish
refactor: valibot plugin nullish
OpenAPI discriminator mappings use string keys, but the actual discriminator
property may be boolean, integer, or number. Previously, all discriminator
values were hardcoded as type 'string'. This change detects the actual
property type from the schema and converts mapping values accordingly.
Expose onRequest in RequestOptions for SSE request interception
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
refactor: allow path in top-level detect function
test: split typecheck step into two
fix: maximum call stack exceeded
test: use references in test packages
feature(angular/common): generate meaningful generics for HttpRequests instead of unknown
The fixDanglingRefs() function was handling invalid OpenAPI/JSON Schema usage where external files use local-looking refs (e.g., #/components/schemas/SchemaB) to reference schemas in other external files.
Per JSON Schema and OpenAPI specifications, a ref starting with # is a local reference to the current document only. Cross-file references must use proper relative or absolute URIs.
Removed:
- fixDanglingRefs() function from bundle.ts
- Cross-file reference test case
- Test spec files: cross-file-ref-*.json
- Associated snapshot file
Invalid specs should fail with clear errors rather than being silently "fixed". Users with such specs should be asked to use correct syntax like "file2.json#/components/schemas/SchemaB".
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Only add file prefix to external schema names when there's a naming conflict. This results in cleaner schema names like "User" instead of "file1_User" when there's no ambiguity.
Changes:
- Modified remap() to try unprefixed names first
- Only add file prefix when the unprefixed name is already taken
- Updated fixDanglingRefs() to handle both prefixed and unprefixed names
- Updated test snapshots to reflect new cleaner naming
- Verified conflict resolution still works correctly
Example:
- No conflict: "SchemaA" (was "file1_SchemaA")
- With conflict: First gets "User", second gets "file2_User"
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Created expectBundledSchemaToMatchSnapshot() helper to eliminate repeated code in all 5 bundle tests. The helper handles:
- Creating output and snapshot paths
- Ensuring directory exists
- Writing bundled result to temp file
- Comparing with snapshot
This reduces duplication and makes tests more maintainable.
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Following the pattern from Zod v4 tests, convert bundle tests from value comparisons to snapshot testing for better visibility of bundled specs.
Changes:
- Added __snapshots__ directory with JSON snapshot files for each test
- Updated bundle.test.ts to use toMatchFileSnapshot matcher
- All 5 tests now write bundled output to temp directory and compare with snapshots
- Snapshots provide complete visibility of bundled spec structure
- Removed verbose assertion code, replaced with simple snapshot comparisons
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
When an external file references a schema from another external file using a local-looking ref (e.g., #/components/schemas/SchemaB), the bundle() function would:
1. Try to resolve it relative to the current file
2. Fail and log "Skipping unresolvable $ref"
3. Leave the ref as-is in the bundled output
4. Create a dangling reference since SchemaB is hoisted with a different name
Added fixDanglingRefs() post-processing step that:
- Identifies dangling internal $refs
- Matches them to hoisted schemas from other files
- Rewrites them to the correct hoisted names
Test case added: cross-file reference scenario
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
- Created test specs with external files containing multiple schemas
- Added test case for sibling schema hoisting in bundle.test.ts
- All tests pass - sibling schemas are correctly hoisted
- Tested with local files, nested references, and HTTP URLs
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>