@typespec/openapi3
Advanced tools
Comparing version 0.51.0-dev.8 to 0.51.0-dev.9
@@ -1,2 +0,2 @@ | ||
import { BooleanLiteral, Enum, EnumMember, IntrinsicType, Model, ModelProperty, NumericLiteral, Program, Scalar, StringLiteral, Tuple, Type, Union, UnionVariant } from "@typespec/compiler"; | ||
import { BooleanLiteral, Enum, EnumMember, IntrinsicType, Model, ModelProperty, NumericLiteral, Program, Scalar, StringLiteral, StringTemplate, Tuple, Type, Union, UnionVariant } from "@typespec/compiler"; | ||
import { AssetEmitter, Context, Declaration, EmitEntity, EmitterOutput, ReferenceCycle, Scope, TypeEmitter } from "@typespec/compiler/emitter-framework"; | ||
@@ -31,2 +31,3 @@ import { MetadataInfo } from "@typespec/http"; | ||
stringLiteral(string: StringLiteral): EmitterOutput<object>; | ||
stringTemplate(string: StringTemplate): EmitterOutput<object>; | ||
numericLiteral(number: NumericLiteral): EmitterOutput<object>; | ||
@@ -33,0 +34,0 @@ enumDeclaration(en: Enum, name: string): EmitterOutput<object>; |
@@ -13,3 +13,3 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
var _OpenAPI3SchemaEmitter_instances, _OpenAPI3SchemaEmitter_metadataInfo, _OpenAPI3SchemaEmitter_visibilityUsage, _OpenAPI3SchemaEmitter_options, _OpenAPI3SchemaEmitter_applyExternalDocs, _OpenAPI3SchemaEmitter_typeNameOptions, _OpenAPI3SchemaEmitter_getVisibilityContext, _OpenAPI3SchemaEmitter_getContentType, _OpenAPI3SchemaEmitter_requiredModelProperties, _OpenAPI3SchemaEmitter_enumSchema, _OpenAPI3SchemaEmitter_unionSchema, _OpenAPI3SchemaEmitter_getDiscriminatorMapping, _OpenAPI3SchemaEmitter_attachExtensions, _OpenAPI3SchemaEmitter_getDefaultValue, _OpenAPI3SchemaEmitter_getSchemaForScalar, _OpenAPI3SchemaEmitter_getSchemaForStdScalars, _OpenAPI3SchemaEmitter_applyConstraints, _OpenAPI3SchemaEmitter_inlineType, _OpenAPI3SchemaEmitter_createDeclaration, _OpenAPI3SchemaEmitter_isStdType, _OpenAPI3SchemaEmitter_applyEncoding, _OpenAPI3SchemaEmitter_mergeFormatAndEncoding; | ||
import { compilerAssert, getDeprecated, getDiscriminatedUnion, getDiscriminator, getDoc, getEncode, getFormat, getKnownValues, getMaxItems, getMaxLength, getMaxValue, getMaxValueExclusive, getMinItems, getMinLength, getMinValue, getMinValueExclusive, getNamespaceFullName, getPattern, getSummary, getTypeName, ignoreDiagnostics, isArrayModelType, isNeverType, isNullType, isSecret, isTemplateDeclaration, } from "@typespec/compiler"; | ||
import { compilerAssert, getDeprecated, getDiscriminatedUnion, getDiscriminator, getDoc, getEncode, getFormat, getKnownValues, getMaxItems, getMaxLength, getMaxValue, getMaxValueExclusive, getMinItems, getMinLength, getMinValue, getMinValueExclusive, getNamespaceFullName, getPattern, getSummary, getTypeName, ignoreDiagnostics, isArrayModelType, isNeverType, isNullType, isSecret, isTemplateDeclaration, stringTemplateToString, } from "@typespec/compiler"; | ||
import { ArrayBuilder, ObjectBuilder, Placeholder, TypeEmitter, } from "@typespec/compiler/emitter-framework"; | ||
@@ -217,2 +217,12 @@ import { getVisibilitySuffix, Visibility } from "@typespec/http"; | ||
} | ||
stringTemplate(string) { | ||
const [value, diagnostics] = stringTemplateToString(string); | ||
if (diagnostics.length > 0) { | ||
this.emitter | ||
.getProgram() | ||
.reportDiagnostics(diagnostics.map((x) => ({ ...x, severity: "warning" }))); | ||
return { type: "string" }; | ||
} | ||
return { type: "string", enum: [value] }; | ||
} | ||
numericLiteral(number) { | ||
@@ -219,0 +229,0 @@ return { type: "number", enum: [number.value] }; |
{ | ||
"name": "@typespec/openapi3", | ||
"version": "0.51.0-dev.8", | ||
"version": "0.51.0-dev.9", | ||
"author": "Microsoft Corporation", | ||
@@ -5,0 +5,0 @@ "description": "TypeSpec library for emitting OpenAPI 3.0 from the TypeSpec REST protocol binding", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
254374
3301