Skip to content

Adding new pre and post processing steps#36

Open
thanmayee75 wants to merge 10 commits into
mainfrom
tp/enbw
Open

Adding new pre and post processing steps#36
thanmayee75 wants to merge 10 commits into
mainfrom
tp/enbw

Conversation

@thanmayee75

Copy link
Copy Markdown
Collaborator

Description

Added XML pre-processing step to repair malformed input before parsing
Enriched OpenAPI field descriptions from source CSDL annotations
Relaxed $select/$expand/$orderby schemas to accept free-form string values
Collapsed concrete 4xx/5xx responses into 4XX/5XX range codes
Added opt-in $apply query parameter injection for collection endpoints
Added opt-in $top required constraint to prevent unbounded reads
Skipped /$batch path by default; added flag to include it
Enabled ER diagram generation by default
Added CLI flags for custom description, apply, require-top, and include-batch
Added corresponding unit tests for all new transforms

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the project's style guidelines (npm run lint passes)
  • I have added/updated tests that prove my fix or feature works
  • All new and existing tests pass (npm test)
  • I have updated documentation if needed

Copilot AI review requested due to automatic review settings July 8, 2026 10:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the OASIS OData→OpenAPI conversion pipeline with additional pre-processing and post-processing steps aimed at producing more APIM-friendly specs (XML repair, richer descriptions, schema relaxations, response normalization), and exposes new opt-in knobs via both CLI flags and the web UI.

Changes:

  • Added XML pre-parse repair and CSDL enrichment to preserve SAP field labels/tooltips as OpenAPI title/description.
  • Expanded the post-processing pipeline with query-option schema relaxation, error-response collapsing, and opt-in $apply and required $top transforms.
  • Updated CLI, web UI, and documentation to surface new options; added unit tests for the new behaviors.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Documents new UI toggles and new CLI flags / APIM-ready behaviors.
OASIS/tests/unit/helper.test.js Adds unit coverage for HEAD CSRF response headers, relaxed query option schemas, and $apply injection.
OASIS/tests/unit/escapeXml.test.js Adds tests for XML repair (escapeStrayXmlChars).
OASIS/tests/unit/enrichDescriptions.test.js Adds tests for SAP annotation enrichment (V2 + V4).
OASIS/tests/unit/converter.test.js Adds end-to-end tests for ER diagram embedding, $top guard, and /$batch default skipping.
OASIS/tests/unit/collapseErrorResponses.test.js Adds unit and end-to-end tests for collapsing concrete 4xx/5xx codes into 4XX/5XX.
OASIS/README.md Updates package-level docs for new flags and APIM-ready output description.
OASIS/core/strings.js Updates example URLs in server URL validation messages.
OASIS/core/postprocessing/transforms/requireTopParameter.js New transform to make $top required and defaulted (opt-in).
OASIS/core/postprocessing/transforms/relaxQueryOptionSchemas.js New transform to relax $select/$expand/$orderby schemas to free-form strings.
OASIS/core/postprocessing/transforms/ensureApplyParameter.js New transform to inject $apply into collection GETs (opt-in).
OASIS/core/postprocessing/transforms/collapseErrorResponses.js New transform to normalize error responses to 4XX/5XX.
OASIS/core/postprocessing/transforms/addHeadMethods.js Declares X-CSRF-Token response header on root and /$metadata HEAD 200s.
OASIS/core/postprocessing/PostProcessorBuilder.js Wires in new transforms and adds options to the standard pipeline.
OASIS/core/postprocessing/index.js Extends postProcess to accept options for opt-in transforms and exports new helpers/constants.
OASIS/core/converter/pipeline.js Adds XML normalization + enrichment, enables ER diagrams by default, supports includeBatch, and passes post-process options.
OASIS/core/converter/escapeXml.js Implements the XML stray-character repair pre-processing step.
OASIS/core/converter/enrichDescriptions.js Implements CSDL enrichment for SAP field captions/tooltips (V2 + V4).
OASIS/cli/commands/convert.js Adds CLI flags for description/apply/require-top/include-batch and forwards options.
OASIS/cli/commands/batch.js Adds CLI flags for apply/require-top/include-batch and forwards options.
OASIS/app/src/strings.js Adds UI copy for new description field and toggles.
OASIS/app/src/convert.jsx Adds description input + three toggle controls and includes them in API requests.
OASIS/api/src/functions/convert-handler.js Accepts and forwards new request options (description/apply/requireTop/includeBatch).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread OASIS/app/src/convert.jsx
Comment on lines 289 to +294
body: JSON.stringify({
fileName: f.name,
content: f.content,
...(serverUrl.trim() && { serverUrl: serverUrl.trim() }),
...(apiTitle.trim() && { title: apiTitle.trim() }),
...(apiDescription.trim() && { description: apiDescription.trim() }),
Comment thread OASIS/app/src/convert.jsx
Comment on lines 431 to 435
const handleReset = () => {
setFiles([]);
setSkippedFiles([]);
setServerUrl("");
setApiTitle("");
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.

2 participants