chore(dtdl-parser): cleaning up and fixing bugs#20300
Conversation
|
API changes have been detected in API changes - export declare type DtmiResolver = (identifiers: string[]) => Promise<string[] | null>;
+ export declare type DtmiResolver = (dtmis: string, options?: GetModelsOptions) => Promise<{
+ [dtmi: string]: unknown;
+ } | null>; |
|
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
There was a problem hiding this comment.
This seems like a change that needs to be taken to the parser node repo.
There was a problem hiding this comment.
yes but we will integrate it into the monorepo to make the changes more permanent and easier to manage.
There was a problem hiding this comment.
Top level await requires Node 14+, our min bar is presently Node 12
There was a problem hiding this comment.
will remove top level await
There was a problem hiding this comment.
@azure/iot-modelsrepository is added as a dev dependency, but this looks like a runtime dependency?
There was a problem hiding this comment.
yeah this is something definitely need to sort out before GA. For now I'll move to dependencies to get the package working.
There was a problem hiding this comment.
mixing await and promise chaining is weird
| const additionalJsonTexts = await this.dtmiResolver(undefinedIdentifiers).then((value: {[dtmi: string]: unknown}) => { | |
| return Object.values(value).map((value) => JSON.stringify(value)) | |
| }); | |
| const value:{[dtmi: string]: unknown} = await this.dtmiResolver(undefinedIdentifiers); | |
| const additionalJsonTexts = Object.values(value).map((value) => JSON.stringify(value)); |
There was a problem hiding this comment.
Do we have a general preference between { [dtmi: string]: unknown } and Record<string, unknown>? In this particular case IMO the former syntax is a little harder to parse with the promise and union.
There was a problem hiding this comment.
fair. for now going to add this to the issue created to handle more feedback on the Parser before GA, to get this sorted out fully across the library.
There was a problem hiding this comment.
I commented on the feedback issue, agreed we can sort this out more later since I don't think it would be considered breaking
3c3c421 to
ba5bb6d
Compare
|
There are unresolved q's / comments in this PR that are out of scope of the work here. They've been moved to the issue tracking Preview Feedback. Other than that I hope to merge this and release the update today. |
|
API changes have been detected in API changes - export declare type DtmiResolver = (identifiers: string[]) => Promise<string[] | null>;
- dtmiResolver?: DtmiResolver;
+ getModels?: ModelsRepositoryClient["getModels"]; |
|
I'm noticing errors on the build pipeline for browser tests in TOTAL: 70 FAILED, 58 SUCCESS
Returned error code: 1
"@azure/digital-twins-core" failed to build.
==[ SUCCESS: 2 projects ]======================================================
These projects completed successfully:
@azure/arm-digitaltwins 0.04 seconds
@azure/dtdl-parser 15.08 seconds
==[ FAILURE: 1 project ]=======================================================
--[ FAILURE: @azure/digital-twins-core ]--------------------[ 34.32 seconds ]--
Invoking: karma start --single-run
Projects failed to build.
17 02 2022 22:05:41.141:INFO [preprocessor.env]: Publishing variables: [
'AZURE_DIGITALTWINS_URL',
'AZURE_CLIENT_ID',
'AZURE_CLIENT_SECRET',
'AZURE_TENANT_ID',
'TEST_MODE'
]
...2520 lines omitted...
at async tryGetAccessToken (../../core/core-http/src/policies/bearerTokenAuthenticationPolicy.ts:85:26 <- dist-test/index.browser.js:32880:33)
at async beginRefresh$2 (../../core/core-http/src/policies/bearerTokenAuthenticationPolicy.ts:96:11 <- dist-test/index.browser.js:32888:18)
at async BearerTokenAuthenticationPolicy.sendRequest (../../core/core-http/src/policies/bearerTokenAuthenticationPolicy.ts:251:23 <- dist-test/index.browser.js:33009:32)
at async ThrottlingRetryPolicy$1.sendRequest (../../core/core-http/src/policies/throttlingRetryPolicy.ts:69:16 <- dist-test/index.browser.js:33433:27)
at async AzureDigitalTwinsAPI.sendOperationRequest (../../core/core-http/src/serviceClient.ts:522:23 <- dist-test/index.browser.js:35938:32)
at async createModel (test/public/testRelationships.spec.ts:122:3 <- dist-test/index.browser.js:84750:10)
at async setUpModels (test/public/testRelationships.spec.ts:127:3 <- dist-test/index.browser.js:84754:10)
at async Context.<anonymous> (test/public/testRelationships.spec.ts:1289:5 <- dist-test/index.browser.js:85482:10)
TOTAL: 70 FAILED, 58 SUCCESSI haven't made any changes to that folder I think. @xirzec am I reading the test failure correctly? |
Hm looks like it's caused by the recorder not handling requests to identity during playback: My first solution to confusing failures like this is to re-merge main and try again. |
3090881 to
c4df98b
Compare
yep I've force pushed a freshly rebased branch with two commits now for the changes. Let's see if that sorts it out... |
Some incremental changes: