You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
SchemaContext.getSchemaSync throws an exception possibly due to a bug of how Promises are handled in ECSchemaRpcLocater.getSchemaSync
To Reproduce
Call SchemaContext.getSchemaSync method
An error with "An ECSchema is missing the require 'name' attribute" message is thrown
Expected behavior
Schema should be loaded Synchroniously
Desktop (please complete the applicable information):
OS: Windows 10
iTwin Studio 1.0.133
iTwin.js Version 4.10.6
Additional context schemaJson is an instance of Promise. And is passed to Schema.fromJsonSync method.
Since Schema.fromJsonSync can accept any object type, typescript compiler loses all info that the passed object is a Promise and is passed to reader.readSchemaSync as rawSchema
The promise is then being treated as SchemaProps object which results in an exception
I propose that we just replace the sync implementation with code that throws right away. You should only use the async method when locating a schema over rpc/http.
Describe the bug
SchemaContext.getSchemaSync throws an exception possibly due to a bug of how Promises are handled in ECSchemaRpcLocater.getSchemaSync
To Reproduce
Expected behavior
Schema should be loaded Synchroniously
Desktop (please complete the applicable information):
Additional context

schemaJson
is an instance of Promise. And is passed to Schema.fromJsonSync method.Since Schema.fromJsonSync can accept any object type, typescript compiler loses all info that the passed object is a Promise and is passed to reader.readSchemaSync as rawSchema

The promise is then being treated as SchemaProps object which results in an exception
itwinjs-core/core/ecschema-metadata/src/Deserialization/JsonParser.ts
Line 64 in 9a1fa6e
The text was updated successfully, but these errors were encountered: