Adding new pre and post processing steps#36
Open
thanmayee75 wants to merge 10 commits into
Open
Conversation
There was a problem hiding this comment.
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
$applyand required$toptransforms. - 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 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 on lines
431
to
435
| const handleReset = () => { | ||
| setFiles([]); | ||
| setSkippedFiles([]); | ||
| setServerUrl(""); | ||
| setApiTitle(""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Checklist
npm run lintpasses)npm test)