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
{{ message }}
Repository navigation
December spring breaking changes and deprecations #1263
CadlApiCompiler Moved cadl intrinsic types to a new Type scalar
A new type has been introduced to cadl in order to differentiate scalar from structured models types. Those new types can be declared using scalar and can extend another scalar using extends.
Change to cadl intrinsic models
All of Cadl intrinsic models have been updated to be scalar types instead of model. In most cases this shouldn't affect a spec but if you are defining a custom model that is one of the intrinsic types you'll have to update it
Before
model MyStr is string;
After
scalar MyStr extends string;
Migration script
The following script can be used to automatically migrate previous usages.
npx @cadl-lang/migrate
Change to Compiler API
Removed:
getIntrinsicModelName: Check it is a std type with program.checker.isStdType(type) and then use the type.name otherwise look for type.baseScalar
isIntrinsic: Check it is a std type with program.checker.isStdType(type) or just remove the check if goal was to omit intrinsic types from models.
Migration:
Add a new switch to handle the new scalar type
To resolve a scalar type, check if its a std type using program.checker.isStdType(type)
If yes, do the same behavior has before with getIntrinsicModelName
Activity
timotheeguerin commentedon Nov 11, 2022
[Api] Change to
onEmitsignatureThe signature of
onEmithas been updated.Before
Now
Access properties
programcontext.programoptionscontext.optionsoptions["output-dir"]context.emitterOutputDirSee details[Cadl] [Api] Emitter option
output-dirrenamed toemitter-output-dirThe option has been renamed for all emitters as
emitter-output-diris now managed in the compilerBefore
Now
Change to api
Before
Now
timotheeguerin commentedon Nov 18, 2022
APIcompilerMultiple services per cadl specs are now allowed making a service accessor obsolete.The following functions have been deprecated
and replaced with
Other changes to the service resolution:
(title)0000-00-00getServiceNamespace(program)listServices(program)to get all servicesgetServiceNamespaceString(program)getNamespaceName(service.type)is where service isgetService(program, serviceNamespace)getServiceTitle(program)service.titlewhere service isgetService(program, serviceNamespace)getServiceVersion(program)service.versionwhere service isgetService(program, serviceNamespace)timotheeguerin commentedon Nov 21, 2022
CadlApiCompilerMoved cadl intrinsic types to a new TypescalarA new type has been introduced to cadl in order to differentiate scalar from structured models types. Those new types can be declared using
scalarand can extend another scalar usingextends.Change to cadl intrinsic models
All of Cadl intrinsic models have been updated to be
scalartypes instead ofmodel. In most cases this shouldn't affect a spec but if you are defining a custom model thatisone of the intrinsic types you'll have to update itBefore
After
Migration script
The following script can be used to automatically migrate previous usages.
Change to Compiler API
Removed:
getIntrinsicModelName: Check it is a std type withprogram.checker.isStdType(type)and then use thetype.nameotherwise look fortype.baseScalarisIntrinsic: Check it is a std type withprogram.checker.isStdType(type)or just remove the check if goal was to omit intrinsic types from models.Migration:
scalartypeprogram.checker.isStdType(type)getIntrinsicModelNamescalar.baseScalarand repeat step 2.nguerrera commentedon Nov 28, 2022
Directives can no longer be placed in certain contexts.
For example, this is no longer valid:
And will now result in an error "Cannot place directive on template parameter".
Move such directives up to the nearest statement, interface operation, model property, operation parameter, union variant, or enum member.
For the above example, that would be:
tjprescott commentedon Dec 2, 2022
cadl-rest
@segmentSeparatoris deprecated. The@actionSeparatordecorator should be used instead.timotheeguerin commentedon Dec 2, 2022
CadlDeprecateduribeing replaced byurlBefore:
Now: