@typespec/openapi3
Advanced tools
Comparing version 0.52.0-dev.1 to 0.52.0-dev.2
@@ -12,3 +12,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; | ||
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"; | ||
@@ -57,3 +57,3 @@ import { ArrayBuilder, ObjectBuilder, Placeholder, TypeEmitter, } from "@typespec/compiler/emitter-framework"; | ||
if (contentType === "application/json") { | ||
delete patch.contentType; | ||
patch.contentType = undefined; | ||
} | ||
@@ -166,8 +166,11 @@ return patch; | ||
const isMultipart = __classPrivateFieldGet(this, _OpenAPI3SchemaEmitter_instances, "m", _OpenAPI3SchemaEmitter_getContentType).call(this).startsWith("multipart/"); | ||
if (isMultipart && | ||
prop.type.kind === "Scalar" && | ||
prop.type.name === "bytes" && | ||
getEncode(program, prop.type) === undefined && | ||
getEncode(program, prop) === undefined) { | ||
return { type: "string", format: "binary" }; | ||
if (isMultipart) { | ||
if (__classPrivateFieldGet(this, _OpenAPI3SchemaEmitter_instances, "m", _OpenAPI3SchemaEmitter_isBytesKeptRaw).call(this, prop.type) && getEncode(program, prop) === undefined) { | ||
return { type: "string", format: "binary" }; | ||
} | ||
if (prop.type.kind === "Model" && | ||
isArrayModelType(program, prop.type) && | ||
__classPrivateFieldGet(this, _OpenAPI3SchemaEmitter_instances, "m", _OpenAPI3SchemaEmitter_isBytesKeptRaw).call(this, prop.type.indexer.value)) { | ||
return { type: "array", items: { type: "string", format: "binary" } }; | ||
} | ||
} | ||
@@ -358,2 +361,5 @@ const refSchema = this.emitter.emitTypeReference(prop.type, { | ||
return requiredProps.length > 0 ? requiredProps : undefined; | ||
}, _OpenAPI3SchemaEmitter_isBytesKeptRaw = function _OpenAPI3SchemaEmitter_isBytesKeptRaw(type) { | ||
const program = this.emitter.getProgram(); | ||
return (type.kind === "Scalar" && type.name === "bytes" && getEncode(program, type) === undefined); | ||
}, _OpenAPI3SchemaEmitter_enumSchema = function _OpenAPI3SchemaEmitter_enumSchema(en) { | ||
@@ -360,0 +366,0 @@ var _a; |
{ | ||
"name": "@typespec/openapi3", | ||
"version": "0.52.0-dev.1", | ||
"version": "0.52.0-dev.2", | ||
"author": "Microsoft Corporation", | ||
@@ -41,3 +41,3 @@ "description": "TypeSpec library for emitting OpenAPI 3.0 from the TypeSpec REST protocol binding", | ||
"dependencies": { | ||
"yaml": "~2.3.4" | ||
"yaml": "~2.3.2" | ||
}, | ||
@@ -51,3 +51,3 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@types/mocha": "~10.0.6", | ||
"@types/mocha": "~10.0.1", | ||
"@types/node": "~18.11.9", | ||
@@ -63,3 +63,3 @@ "@typespec/compiler": "~0.51.0 || >=0.52.0-dev <0.52.0", | ||
"@typespec/tspd": "~0.46.0 || >=0.47.0-dev <0.47.0", | ||
"eslint": "^8.55.0", | ||
"eslint": "^8.49.0", | ||
"mocha": "~10.2.0", | ||
@@ -70,3 +70,3 @@ "mocha-junit-reporter": "~2.2.1", | ||
"rimraf": "~5.0.1", | ||
"typescript": "~5.3.3" | ||
"typescript": "~5.2.2" | ||
}, | ||
@@ -73,0 +73,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
3309
255673
Updatedyaml@~2.3.2