Skip to content

Releases: microsoft/typespec

@typespec/[email protected]

25 Mar 03:10
71dc4ec
Compare
Choose a tag to compare
Pre-release

Features

  • #6565 Make handling of request body and response body consistent
  • #6543 Rename server-test command to knock

Bump dependencies

  • #6595 Upgrade dependencies

Bug Fixes

  • #6527 Don't throw for scenarios that expect error response
  • #6562 Updates tsp-spector knock to exit with a failure if no scenarios are executed
  • #6543 Add new --filter option to knock command

@typespec/[email protected]

25 Mar 03:10
71dc4ec
Compare
Choose a tag to compare
Pre-release

Features

  • #6565 Make handling of request body and response body consistent

Bump dependencies

  • #6595 Upgrade dependencies

@typespec/[email protected]

25 Mar 03:10
71dc4ec
Compare
Choose a tag to compare
Pre-release

Bug Fixes

  • #6565 Fix specs to handle body correctly with new spector change
  • #6533 Update outdated multipart cases

Bump dependencies

  • #6595 Upgrade dependencies

@typespec/[email protected]

24 Mar 21:09
577de3a
Compare
Choose a tag to compare

Bug Fixes

  • #6648 Fix tsp install broken in standalone CLI

@typespec/[email protected]

22 Mar 04:47
38a7d5d
Compare
Choose a tag to compare
Pre-release
Bump version to get package out of the state where the current versio…

@typespec/[email protected]

22 Mar 02:58
0c3275e
Compare
Choose a tag to compare
Pre-release

Features

  • #6507 Scaffolding updates for rc

@typespec/[email protected]

20 Mar 18:19
d7df646
Compare
Choose a tag to compare
Pre-release

Bug Fixes

  • #6521 Add explicit application/json content type for some test cases to avoid wrong content type inferred from http lib.

@typespec/[email protected]

19 Mar 04:36
d2ecae1
Compare
Choose a tag to compare
Pre-release

Bug Fixes

  • #6521 Fix response scenarios

[email protected]

18 Mar 19:34
70084da
Compare
Choose a tag to compare

@typespec/compiler

Breaking Changes

  • #6231 Remove deprecated items:

    • @deprecated decorator, use #deprecated directive instead

      - @deprecated("Message")
      + #deprecated "Message"
    • @service versions support. Either migrate to @OpenAPI.info or the versioning library

      - @service({version: "1.0"})
      + @service
      + @OpenAPI.info(#{version: "1.0"})
    • Removed @knownValues. Use a union with a string variant instead

      - enum MyKnownValues {a, b}
      - @knownValues(MyKnownValues)
      - scalar Custom extends string;
      + union Custom {
      +   "a", "b", string
      + };
    • Removed @projectedName Migrate to @encodedName instead.

      - @projectedName("json", "nbf")
      + @encodedName("application/json", "nbf")
      notBefore: int32;
    • CLI configuration value output-path, use output-dir instead.

    • Support for cadlMain in package.json. Migrate to exports["."].tsp instead.

      - "cadlMain": "lib/main.tsp",
      + "exports": {
      +   ".": {
      +     "tsp": "lib/main.tsp"
      +   }
      + }
    • Compiling .cadl files, use .tsp instead.

    • decoratorArgMarshalling flag in $flags was removed and support for the legacy decorator arg marshalling.

    • Using @format on bytes. @format can only be used on string where it defines a known pattern for the string.

    • Javascript functions and typescript types:

      • stringTemplateToString
      • CadlLanguageConfiguration
      • CadlPrettierPlugin
      • NodePackage -> PackageJson
      • CadlValue -> TypeSpecValue
      • createCadlLibrary -> createTypeSpecLibrary
      • setCadlNamespace -> setTypeSpecNamespace
      • CadlLibrary -> TypeSpecLibrary
      • SyntaxKind.CadlScript -> SyntaxKind.TypeSpecScript
      • isCadlValueTypeOf -> isTypeSpecValueTypeOf
      • cadlTypeToJson -> typespecTypeToJson
      • checkFormatCadl -> checkFormatTypeSpec
      • cadlVersion -> typespecVersion
      • CadlManifest -> TypeSpecManifest
      • validateDecoratorTargetIntrinsic -> Use extern dec to define the signature of decorators instead
      • validateDecoratorParamType -> Use extern dec to define the signature of decorators instead
      • createDecoratorDefinition -> Use extern dec to define the signature of decorators instead
      • CompilerOptions#emitters -> Use emit and options field instead.
      • Type#templateArguments -> Use templateMapper instead.
      • ModelProperty#default -> Use defaultValue instead.
      • Union#options -> Use variants instead.
      • linter in createTypeSpecLibrary -> Use export const $linter = defineLinter({ ... }) instead.
      • Accessor for removed @knownValues decorator
        • getKnownValues
      • Accessor for removed @projectedName decorator
        • getProjectedNames
        • getProjectedName
        • hasProjectedName
  • #6323 Move AST related APIS to @typespec/compiler/ast package. This is to mark a clear separation for the AST types and APIs which are considered for advanced usage and might change at any time.

    • All *Node types
    • exprIsBareIdentifier
    • getFirstAncestor
    • getIdentifierContext
    • getNodeAtPosition
    • getNodeAtPositionDetail
    • hasParseError
    • isImportStatement
    • parse
    • parseStandaloneTypeReference
    • positionInRange
    • visitChildren
  • #6323 Stop exposing APIs that were not meant for external users. Please file issue if you had legitmate use of some of those APIs.

  • Checker: The check itself should be used very carefully and its wouldn't be covered under the compatibility guarantees. There is some apis that were explicitly marked as internal while other remained until we provide a better way to do the same thing:

    • getGlobalNamespaceType(); -> program.getGlobalNamespaceType();
    • resolveTypeReference(); -> program.resolveTypeReference();
    • checkProgram(); This isn't meant to be used by external users.
    • getLiteralType() This isn't meant to be used by external users.
    • resolveRelatedSymbols() This isn't meant to be used by external users.
    • resolveCompletions() This isn't meant to be used by external users.
  • Program: Exposed functions on the program are safe to use but a few have been updated to be internal:

    • mainFile -> Use projectRoot instead.
    • literalTypes This isn't meant to be used by external users.
    • checker: This is still exposed but to be used carefully, see above.
    • loadTypeSpecScript: This isn't meant to be used by external users.
    • onValidate: This isn't meant to be used by external users.
    • reportDuplicateSymbols: This isn't meant to be used by external users.
  • logVerboseTestOutput Internal test util, not meant for external users

  • validateDecoratorTarget -> migrate to extern dec declaration

  • validateDecoratorParamCount: Same as above

  • altDirectorySeparator: Internal path utils

  • directorySeparator: Internal path utils

  • isIntrinsicType: Internal check

  • getFullyQualifiedSymbolName Symbols are an internal aspect of the compiler

  • Scanner related APIs:

    • createScanner
    • isComment
    • isKeyword
    • isModifier
    • isPunctuation
    • isStatementKeyword
    • isTrivia
    • skipContinuousIdentifier
    • skipTrivia
    • skipTriviaBackward
    • skipWhiteSpace
    • Token
    • TokenFlags
    • typeDocToken,
    • typeScanner,
    • typeStringTemplateToken,
  • Types

    • Sym Symbols are an internal aspect of the compiler
    • SymbolLinks Symbols are an internal aspect of the compiler
    • SymbolTable Symbols are an internal aspect of the compiler
    • SymbolFlags Symbols are an internal aspect of the compiler
    • MutableSymbolTable Symbols are an internal aspect of the compiler
    • ResolutionResult Internal type used in non exposed resolver
    • NodeLinks Internal type used in non exposed resolver
    • ResolutionResultFlags Internal type used in non exposed resolver
    • MetaMemberKey Unused type
    • MetaMembersTable Unused type
    • Dirent Unused type
  • #5977 Minimum node version is now 20

  • #6410 Remove a legacy behavior of resolving package names which wasn't inline with node ESM module resolution.

    For example if you were running tsp compile within your node_modules folder(on a test package) and referencing your emitter by name you might need to change this

    -tsp compile . --emit my-emitter
    +tsp compile . ../../  # path to your emitter root instead
  • #6286 Removed deprecated use of @discriminator on union. Migrate to @discriminated

    -@discriminator("type")
    +@discriminated(#{envelope: "none", discriminatorPropertyName: "type"})
    union Pet;
  • #6327 Remove projection. Projection was an experiemental syntax that was too flawed to be included in 1.0 in that current state.

  • #6388 Remove deprecated type to value conversion. Since the introductions of object values(#{}) and array values(#[]) using model expressions or tuple where values were expected has been deprecated. It is now an error with a codefix.

    -@service({title: "My service"})
    +@service(#{title: "My service"})
  • #6416 Adding new keywords for future use:

    • statemachine
    • macro
    • package
    • metadata
    • env
    • arg
    • declare
    • array
    • struct
    • record
    • module
    • mod
    • pub
    • sub
    • typeref
    • trait
    • this
    • self
    • super
    • keyof
    • with
    • implements
    • impl
    • satisfies
    • flag
    • auto
    • partial
    • private
    • public
    • protected
    • internal
    • sealed
    • local
    • async
  • #6258 Removed deprecated legacy visibility APIs and converted all warnings for using string-based visibility modifiers to errors.

The removed APIs include:

  • getVisibility: use getVisibilityForClass instead.
  • getParameterVisibility: use getParameterVisibilityFilter instead.
  • getReturnTypeVisibility: use getReturnTypeVisibilityFilter instead.

Furthermore, the legacy signature of isVisible that accepts an array of strings has been removed. Please use the new signature that accepts EnumMember instead.

The changed decorators include:

  • @visibility
  • @parameterVisibility
  • @returnTypeVisibility
  • @withVisibility
  • @withDefaultKeyVisibility

The TypeSpec.DefaultKeyVisibility template also no longer accepts a string as a visibility modifier argument.

Attempting to pass a string to any of the above decorators or templates will now result in a type-checking error. Please use the Lifecycle visibility modifiers instead.

If you develop a third-party library and you use any custom visibility modifiers, you will need to instead define a visibility class enum. See: Visibility | TypeSpec.

Migration steps:

String-based visibilities can be replaced as follows:

  • "create", "read", "update", "delete", and "query" can be replaced with Lifecycle.Create, Lifecycle.Read, Lifecycle.Update, Lifecycle.Delete, and Lifecycle.Query respectively.
  • @visibility("none") can be replaced with @invisible(Lifecycle).

For example:

@visibility("create", "read")
example: string;

can be replaced with:

@visibility(Lifecycle.C...
Read more

[email protected]

19 Mar 00:43
81c1b33
Compare
Choose a tag to compare
Remove unnecessary empty string check (#6519)

Fixes https://github.com/microsoft/typespec/issues/4344