Skip to content

Add comprehensive test coverage for Relations and ucumUnit#171

Merged
clemensv merged 20 commits into
masterfrom
test/relations-and-ucum-unit-coverage
Jun 8, 2026
Merged

Add comprehensive test coverage for Relations and ucumUnit#171
clemensv merged 20 commits into
masterfrom
test/relations-and-ucum-unit-coverage

Conversation

@clemensv
Copy link
Copy Markdown
Contributor

@clemensv clemensv commented Jun 8, 2026

Adds test cases across all 11 SDK languages covering:

ucumUnit keyword:

  • Valid numeric schemas with ucumUnit
  • Dual unit + ucumUnit coexistence
  • Invalid non-numeric type rejection
  • Invalid value type rejection

Relations extension:

  • Valid identity declarations
  • Valid relation declarations (single/multiple cardinality, scope, qualifiertype)
  • Invalid identity on non-object
  • Invalid cardinality values
  • Missing required relation fields

Addresses #167, #168

clemensv and others added 20 commits June 8, 2026 13:14
Covers schema validation for:
- ucumUnit keyword (valid numeric, invalid non-numeric, invalid value types)
- Relations keywords (identity, relations, targettype, cardinality, scope, qualifiertype)
- Both valid and invalid schema patterns

All 11 SDK languages: TypeScript, Python, .NET, Java, Go, Rust, Ruby, Perl, PHP, Swift, C

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add Units and Relations extension keyword sets
- Validate ucumUnit: must be string, only on numeric types
- Validate identity: must be array of strings, only on object/tuple
- Validate relations: check targettype, cardinality, scope, qualifiertype
- Un-skip all related tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add JSONStructureRelations to known extensions
- Validate ucumUnit: must be string, only on numeric types
- Validate identity: must be array of strings, only on object/tuple
- Validate relations: check targettype, cardinality, scope, qualifiertype
- Un-skip all related tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add ucumUnit and relations keywords to known keyword list
- Add JSONStructureRelations to known extensions
- Validate ucumUnit: must be string, only on numeric types
- Validate identity: must be array of strings, only on object/tuple
- Validate relations: check targettype, cardinality, scope, qualifiertype
- Un-skip all related tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PHP: Escape $ref in double-quoted string interpolation at line 633
to prevent 'Undefined variable \' warning (triggered by 4 tests).

Perl: Add looks_like_number() check to catch numeric scalars passed
as ucumUnit value (JSON number 42 was not caught by ref() check).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…cement

All 11 SDKs now have full spec coverage for extension keyword gating:

- C, Ruby: Added Validation extension gating (warn when validation
  keywords like pattern, minLength, etc. are used without
  $uses: [JSONStructureValidation])
- All 10 non-TS SDKs: Added unit/currency/symbols gating under
  JSONStructureUnits extension. The unit keyword now gets
  string + numeric type validation (same as ucumUnit).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tests using the unit keyword need JSONStructureUnits in $uses
now that extension gating is enforced.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds 33 new tests (124 total, 9 skipped) covering:
- $extends: valid, invalid target, circular, deep circular, non-string
- Nested invalid schemas: inside properties, items, values, definitions
- Multiple simultaneous errors in one schema
- Extension keyword nesting (root $uses enabling nested keywords)
- Complex $ref positions: unions, relations targettype/qualifiertype
- $id edge cases: missing, empty, relative URI, valid URN
- name edge cases: digit prefix, spaces, valid underscore
- Enum edge cases: null values, single element, duplicates
- Choice type: empty, invalid, valid multi-choice
- Unknown keywords: silently ignored

9 tests are skipped with TODO comments documenting validator gaps:
- $extends target type enforcement
- Tuple entry type reference resolution
- Root $uses inheritance into nested schemas
- $id URI syntax validation
- name identifier syntax enforcement
- Enum value type checking against declared type

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Implement remaining validation features across all 11 SDKs:
-  target must resolve to object/tuple type
- Tuple  entries validated for existence
- Empty  rejected
-  must have URI scheme
- name must be valid identifier syntax
- Enum values checked against declared type
- Fix  inheritance: nested schemas inherit root  (Go, Java, TypeScript)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Only enforce object/tuple type requirement when the target has an
explicit 'type' field. Schemas using composition (allOf/oneOf/anyOf)
without 'type' are valid \ targets.

Also fix Perl SCHEMA_CONSTRAINT_VALUE_INVALID missing constant.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The meta-schemas use \ with map types (e.g., ImportAddIn extends
Namespace which is type:map). Broaden check to reject only primitive
types, not all non-object/tuple types.

Also add SCHEMA_CONSTRAINT_VALUE_INVALID to Perl ErrorCodes exports.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Without following the \ chain recursively, circular references
spanning multiple hops (A→B→C→A) would not be detected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@clemensv clemensv merged commit d0f0f64 into master Jun 8, 2026
104 checks passed
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