Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@typespec/openapi

Package Overview
Dependencies
Maintainers
2
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typespec/openapi

TypeSpec library providing OpenAPI concepts

  • 0.63.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
67K
increased by7.25%
Maintainers
2
Weekly downloads
 
Created
Source

@typespec/openapi

TypeSpec library providing OpenAPI concepts

Install

npm install @typespec/openapi

Decorators

TypeSpec.OpenAPI

  • @defaultResponse
  • @extension
  • @externalDocs
  • @info
  • @operationId
  • @tagMetadata
@defaultResponse

Specify that this model is to be treated as the OpenAPI default response. This differs from the compiler built-in @error decorator as this does not necessarily represent an error.

@TypeSpec.OpenAPI.defaultResponse
Target

Model

Parameters

None

Examples
@defaultResponse
model PetStoreResponse is object;

op listPets(): Pet[] | PetStoreResponse;
@extension

Attach some custom data to the OpenAPI element generated from this type.

@TypeSpec.OpenAPI.extension(key: valueof string, value: unknown)
Target

unknown

Parameters
NameTypeDescription
keyvalueof stringExtension key. Must start with x-
valueunknownExtension value.
Examples
@extension("x-custom", "My value")
@extension(
  "x-pageable",
  {
    nextLink: "x-next-link",
  }
)
op read(): string;
@externalDocs

Specify the OpenAPI externalDocs property for this type.

@TypeSpec.OpenAPI.externalDocs(url: valueof string, description?: valueof string)
Target

unknown

Parameters
NameTypeDescription
urlvalueof stringUrl to the docs
descriptionvalueof stringDescription of the docs
Examples
@externalDocs(
  "https://example.com/detailed.md",
  "Detailed information on how to use this operation"
)
op listPets(): Pet[];
@info

Specify OpenAPI additional information. The service title and version are already specified using @service.

@TypeSpec.OpenAPI.info(additionalInfo: TypeSpec.OpenAPI.AdditionalInfo)
Target

Namespace

Parameters
NameTypeDescription
additionalInfoAdditionalInfoAdditional information
@operationId

Specify the OpenAPI operationId property for this operation.

@TypeSpec.OpenAPI.operationId(operationId: valueof string)
Target

Operation

Parameters
NameTypeDescription
operationIdvalueof stringOperation id value.
Examples
@operationId("download")
op read(): string;
@tagMetadata

Specify OpenAPI additional information.

@TypeSpec.OpenAPI.tagMetadata(name: valueof string, tagMetadata: valueof TypeSpec.OpenAPI.TagMetadata)
Target

Namespace

Parameters
NameTypeDescription
namevalueof stringtag name
tagMetadatavalueof TagMetadataAdditional information
Examples
@service
@tagMetadata(
  "Tag Name",
  #{
    description: "Tag description",
    externalDocs: #{ url: "https://example.com", description: "More info.", `x-custom`: "string" },
    `x-custom`: "string",
  }
)
namespace PetStore {

}

Keywords

FAQs

Package last updated on 11 Dec 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc