Repository navigation
draft: move cds import --from asyncapi to plugin - #54
Conversation
This reverts commit b205df0.
SummaryThe following content is AI-generated and provides a summary of the pull request: Move
|
There was a problem hiding this comment.
The PR introduces a solid new cds import --from asyncapi pipeline, but parserContext.js has several correctness issues: types from multiple events on the same service are silently discarded, object schemas without properties crash at runtime, falsy-but-valid path segments break $ref resolution, and known-but-invalid annotations leak into @AsyncAPI.Extensions despite the intention to omit them. Please address all flagged items before merging.
PR Bot Information
Version: 1.29.26
- File Content Strategy: Full file content
- LLM:
anthropic--claude-4.6-sonnet - Correlation ID:
aeafb3a0-964b-11f1-8468-de55f337548e - Event Trigger:
pull_request.ready_for_review
|
Ignoring all the potential fixes for now, this is just to move the code |
daogrady
left a comment
There was a problem hiding this comment.
just the one export I am unclear on. Rest looks good, as it is just a shift from dk to this package. Thanks for the contribution!
Move
cds import --from asyncapito PluginNew Feature
✨ This PR introduces the
cds import --from asyncapifunctionality as a native plugin capability within the@cap-js/asyncapipackage. It adds a full AsyncAPI-to-CSN conversion pipeline, enabling users to import AsyncAPI specifications directly into CAP projects via thecds importcommand.Changes
cds-plugin.js: New plugin entry point that registers bothcds compile -2 asyncapiandcds import --from asyncapihandlers via the CDS plugin API. The import handler reads an AsyncAPI file, converts it to CSN usingasyncapi2csn, and sets the input kind toodata.index.js: Updated to export the newlib/importmodule alongside the existinglib/compilemodule.lib/import/index.js: Entry point for the import library; validates and parses an AsyncAPI JSON document, then delegates toimportAsyncAPI.lib/import/importAsyncAPI.js: Orchestrates the conversion from an AsyncAPI document (viaParserContext) into a CSN object with propermeta,$version, anddefinitionsstructure.lib/import/parserContext.js: Core parser class that extracts services, events, types, annotations, and property mappings from an AsyncAPI document. Handles nested objects/arrays,$refresolution, enum values, defaults, and type conversions.lib/import/utils.js: ProvidesvalidateAsyncAPI(structural validation) andgetRegExpGroups(regex-based event name parsing for<namespace>.<businessObject>.<operation>[.<version>]).lib/import/message.js: Defines error message constants used across the import library.package.json: Addedexportsmap (exposing./cds-plugin), addedcds-plugin.jstofiles, added@sap/cds-dkas a dev dependency, and added a comprehensivecds.schemadefinition covering AsyncAPI compile and import settings.test/lib/import/importAsyncAPI.test.js: Unit tests that iterate over all input AsyncAPI files and compare the generated CSN output against expected.csnfixtures.test/lib/import/input/*.json&test/lib/import/output/*.csn: Test fixtures covering base types, multiple services, and$refresolution scenarios.PR Bot Information
Version:
1.29.18pull_request.opened3f5673f0-9587-11f1-8409-e9821a4709b3anthropic--claude-4.6-sonnet