Skip to content

feat: add OpenAPI mapping validation and schema support#2

Merged
ndenny merged 1 commit intomainfrom
add-unit-tests-and-cicd
Mar 13, 2026
Merged

feat: add OpenAPI mapping validation and schema support#2
ndenny merged 1 commit intomainfrom
add-unit-tests-and-cicd

Conversation

@ndenny
Copy link
Copy Markdown
Member

@ndenny ndenny commented Mar 13, 2026

This pull request introduces schema-based validation for the OpenAPI mapping file, ensuring that mapping documents conform to a defined structure before processing. It also updates documentation and tests to reflect and support this new validation step, and adds a JSON schema file for the mapping format. The main changes are grouped below:

Schema validation and enforcement:

  • Added src/openapi-mapping.schema.json defining the allowed structure for OpenAPI mapping files, including properties like server_url, default_tags, include, exclude, defaults, operations, and workflow.
  • Implemented runtime validation of the OpenAPI mapping file in src/index.js using ajv and the new schema, with fast failure and detailed error reporting. The mapping file is now always validated before transformation. [1] [2]
  • Added additional runtime checks in buildProjectFromOpenApi (src/openapi.js) for key mapping properties (include, exclude, operations, defaults) to ensure correct types are provided.

Documentation updates:

  • Updated README.md to document schema validation, including schema references, YAML language server integration, and a new section describing validation behavior and error output. [1] [2] [3]

Test coverage:

  • Added new tests in test/openapi.test.js to verify that improper types for include, operations, and defaults in the mapping file result in appropriate errors.

Example and schema usage:

  • Updated example mapping files (api/apim-mapping.yaml) and documentation examples to reference the schema for editor integration and validation. [1] [2]

These changes collectively ensure that mapping files are validated early, errors are clear, and documentation and examples are up-to-date with the new validation process.

@ndenny ndenny merged commit 1872eb3 into main Mar 13, 2026
2 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