New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

typespec-decorator-int64-as-string

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typespec-decorator-int64-as-string

A TypeSpec decorator for emitting string type from int64

0.57.0
latest
Source
npm
Version published
Weekly downloads
88
-10.2%
Maintainers
0
Weekly downloads
 
Created
Source

typespec-decorator-int64-as-string

A TypeSpec decorator for emitting string type from int64.

Installation

npm i -D typespec-decorator-int64-as-string
# or
yarn add -D typespec-decorator-int64-as-string
# or
pnpm i -D typespec-decorator-int64-as-string

Usage

In your .tsp files, apply the @int64AsString decorator as follows:

import "typespec-decorator-int64-as-string";

model Foo {
  @int64AsString id: int64;
}

model Bar {
  id: int64;
}

When you emit the above .tsp to OpenAPI using @typespec/openapi3, the following schemas will be generated:

schemas:
  Foo:
    type: object
    required:
      - id
    properties:
      id:
        type: string # Here's the change by the @int64AsString decorator
        format: int64
  Bar:
    type: object
    required:
      - id
    properties:
      id:
        type: integer
        format: int64

You can also perform a global import using tspconfig.yaml:

imports:
  - typespec-decorator-int64-as-string

License

MIT

Keywords

typespec

FAQs

Package last updated on 26 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts