Overview
Code components now have data dependencies introduced in #3533458: Change CodeComponentDataProvider::getRequiredXbDataLibraries() to base its logic on information provided by the front-end rather than on naive string/regex matching. This is not yet handled in the CLI tool.
Proposed resolution
Add the new property in the typing. Make sure it's added by the scaffold command, written by the download command, and handled by the upload command.
This is an incremental change to open the possibility of manually providing data dependencies. The DX will be fixed in #3537654: Detect first-party and data dependency imports.
Issue fork experience_builder-3538775
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
balintbrewsI was thinking about backwards compatibility with the
0.xbranch, and I was ready to go ahead and start different versions for the CLI to address that, but @justafish had a better idea:We could see if in our
uploadcommand we receive a 422 error complaining about thedataDependenciesproperty not being recognized — which would happen with the0.xbranch. In that case, we could retry the request while removingdataDependenciesfrom the payload.Comment #6
balintbrewsComment #7
larowlanIs there any way we can write a test for this? We have the hello-world template component - can we add a test that it validates against the open api file?
https://www.npmjs.com/package/openapi-request-validator looks like what we want
That would prevent changes in Drupal breaking this in the future.
Comment #8
bnjmnmRe #7 discussed this with some folks including @balintbrews / @effulgentsia / @hooroomoo and it was determined that the scenario that needs to be tested here is better implemented as an integration test, as the unit would require a degree of mocking that would limit the test's ability to catch actual problems. Currently, integration tests aren't set up at all and would significantly expand the scope of this issue. The discussion concluded that we should prioritize getting the fix in to address some of the immediate needs of other projects, and focus on integration test implementation in a separate (and likely much larger) issue.
Comment #9
larowlanA simple PHPUnit test that validated hello-world/component.yml against the
#/components/schemas/NewCodeComponentspec in the open API file would have caught this regression. Any objections to me adding that to this branch?Comment #10
larowlanpushed #9, openapi++
Comment #11
wim leersComment #12
hooroomooComment #14
hooroomooI believe https://www.npmjs.com/package/@drupal/xb-cli should get a new tag now, i've notified @balintbrews