test: add XSD constraint and content parsing coverage (closes #2439)#2504
test: add XSD constraint and content parsing coverage (closes #2439)#2504chengyixu wants to merge 4 commits intoasyncapi:masterfrom
Conversation
✅ Deploy Preview for modelina canceled.
|
There was a problem hiding this comment.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
|
Hi! This PR adds comprehensive XSD constraint and content parsing test coverage. All CI checks are green (SonarCloud, Netlify, lint). Ready for review! |
|
Hi maintainers! All checks are passing. This adds 20 new XSD constraint tests covering parseSimpleContent, parseComplexContent, pattern/length/numeric constraints, and inline simpleType. Would love a review when you get a chance. Thanks! |
…i#2439) Adds 20 new tests targeting previously uncovered code paths in XsdSchema.ts and XsdInputProcessor.spec.ts: - simpleContent extension/restriction parsing (parseSimpleContent) - complexContent extension with sequence + attributes (parseComplexContent) - pattern restriction on simpleType - minLength / maxLength string constraints - minInclusive / maxInclusive numeric constraints (each alone + combined) - inline simpleType within element sequences - XsdSchema.toSchema edge cases (empty object, schema attributes) New XSD fixture files: - simple-content.xsd — PersonType with simpleContent extension - complex-content.xsd — Dog extending Animal via complexContent - pattern-restrictions.xsd — EmailType, PasswordType, PercentageType - inline-simple-type.xsd — Product element with inline enum restriction All 34 tests pass; 4 new snapshots captured. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace require() calls with ES import for fast-xml-parser and fix prettier formatting issues. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2e00207 to
229472e
Compare
|
Hi maintainers! I've rebased this branch on the latest master and fixed the lint errors (replaced |
|
Coverage Report for CI Build 24029620313Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+1.1%) to 92.048%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |



Summary
Adds 20 new test cases to
test/processors/XsdInputProcessor.spec.tscovering previously untested code paths identified in #2439.Previously uncovered paths now covered:
parseSimpleContent— complexType withxs:simpleContentextension (e.g.,PersonTypewith base string + attributes)parseComplexContent— complexType withxs:complexContentextension includingxs:sequenceand attributes (Dog extends Animal)parseSimpleTypewithin elements — inlinexs:simpleTyperestriction on element childrenxs:patternonxs:simpleTypexs:minLengthonly,xs:maxLengthonly, and both togetherxs:minInclusiveonly,xs:maxInclusiveonly, and both togetherXsdSchema.toSchemaedge cases — empty object input, schematargetNamespace/elementFormDefault/attributeFormDefaultNew XSD fixture files:
simple-content.xsdPersonTypeusingxs:simpleContentwith extension + attributecomplex-content.xsdDogextendingAnimalviaxs:complexContentextensionpattern-restrictions.xsdEmailType,PasswordType,PercentageType,NonEmptyString,ShortLabelinline-simple-type.xsdProductelement with inlinexs:simpleTyperestriction on child elementsTest count: 34 total (was 14), all passing.
Snapshots: 4 new snapshots added, 1 updated.
Closes #2439
🤖 Generated with Claude Code