@typespec/openapi3
Advanced tools
Comparing version 0.52.0-dev.4 to 0.52.0-dev.5
@@ -13,5 +13,5 @@ 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_isBytesKeptRaw, _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, stringTemplateToString, } 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, resolveEncodedName, stringTemplateToString, } from "@typespec/compiler"; | ||
import { ArrayBuilder, ObjectBuilder, Placeholder, TypeEmitter, } from "@typespec/compiler/emitter-framework"; | ||
import { getVisibilitySuffix, Visibility } from "@typespec/http"; | ||
import { Visibility, getVisibilitySuffix } from "@typespec/http"; | ||
import { checkDuplicateTypeName, getExtensions, getExternalDocs, getOpenAPITypeName, isReadonlyProperty, shouldInline, } from "@typespec/openapi"; | ||
@@ -137,5 +137,7 @@ import { getOneOf, getRef } from "./decorators.js"; | ||
modelProperties(model) { | ||
const program = this.emitter.getProgram(); | ||
const props = new ObjectBuilder(); | ||
const visibility = this.emitter.getContext().visibility; | ||
for (const [name, prop] of model.properties) { | ||
const contentType = __classPrivateFieldGet(this, _OpenAPI3SchemaEmitter_instances, "m", _OpenAPI3SchemaEmitter_getContentType).call(this); | ||
for (const prop of model.properties.values()) { | ||
if (isNeverType(prop.type)) { | ||
@@ -149,5 +151,6 @@ // If the property has a type of 'never', don't include it in the schema | ||
const result = this.emitter.emitModelProperty(prop); | ||
props.set(name, result); | ||
const encodedName = resolveEncodedName(program, prop, contentType); | ||
props.set(encodedName, result); | ||
} | ||
const discriminator = getDiscriminator(this.emitter.getProgram(), model); | ||
const discriminator = getDiscriminator(program, model); | ||
if (discriminator && !(discriminator.propertyName in props)) { | ||
@@ -154,0 +157,0 @@ props.set(discriminator.propertyName, { |
{ | ||
"name": "@typespec/openapi3", | ||
"version": "0.52.0-dev.4", | ||
"version": "0.52.0-dev.5", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
259946
3326