@typespec/openapi3
Advanced tools
Comparing version 0.49.0-dev.10 to 0.49.0-dev.12
import { DecoratorContext, Model, ModelProperty, Program, Type, Union } from "@typespec/compiler"; | ||
export declare function $useRef(context: DecoratorContext, entity: Model | ModelProperty, refUrl: string): void; | ||
export declare function getRef(program: Program, entity: Type): string | undefined; | ||
export declare function $oneOf(context: DecoratorContext, entity: Union): void; | ||
export declare function $oneOf(context: DecoratorContext, entity: Union | ModelProperty): void; | ||
export declare function getOneOf(program: Program, entity: Type): boolean; | ||
//# sourceMappingURL=decorators.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { createStateSymbol } from "./lib.js"; | ||
import { createStateSymbol, reportDiagnostic } from "./lib.js"; | ||
const refTargetsKey = createStateSymbol("refs"); | ||
@@ -11,2 +11,8 @@ export function $useRef(context, entity, refUrl) { | ||
export function $oneOf(context, entity) { | ||
if (entity.kind === "ModelProperty" && entity.type.kind !== "Union") { | ||
reportDiagnostic(context.program, { | ||
code: "oneof-union", | ||
target: context.decoratorTarget, | ||
}); | ||
} | ||
context.program.stateMap(oneOfKey).set(entity, true); | ||
@@ -13,0 +19,0 @@ } |
@@ -55,2 +55,8 @@ import { JSONSchemaType } from "@typespec/compiler"; | ||
readonly diagnostics: { | ||
readonly "oneof-union": { | ||
readonly severity: "error"; | ||
readonly messages: { | ||
readonly default: "@oneOf decorator can only be used on a union or a model property which type is a union."; | ||
}; | ||
}; | ||
readonly "inconsistent-shared-route-request-visibility": { | ||
@@ -153,2 +159,5 @@ readonly severity: "error"; | ||
export declare const $lib: import("@typespec/compiler").TypeSpecLibrary<{ | ||
"oneof-union": { | ||
readonly default: "@oneOf decorator can only be used on a union or a model property which type is a union."; | ||
}; | ||
"inconsistent-shared-route-request-visibility": { | ||
@@ -201,3 +210,6 @@ readonly default: "All operations with `@sharedRoutes` must have the same `@requestVisibility`."; | ||
}, OpenAPI3EmitterOptions>; | ||
export declare const reportDiagnostic: <C extends "inconsistent-shared-route-request-visibility" | "invalid-server-variable" | "invalid-format" | "resource-namespace" | "path-query" | "duplicate-body" | "duplicate-header" | "status-code-in-default-response" | "invalid-schema" | "union-null" | "empty-union" | "empty-enum" | "enum-unique-type" | "invalid-default" | "inline-cycle", M extends keyof { | ||
export declare const reportDiagnostic: <C extends "oneof-union" | "inconsistent-shared-route-request-visibility" | "invalid-server-variable" | "invalid-format" | "resource-namespace" | "path-query" | "duplicate-body" | "duplicate-header" | "status-code-in-default-response" | "invalid-schema" | "union-null" | "empty-union" | "empty-enum" | "enum-unique-type" | "invalid-default" | "inline-cycle", M extends keyof { | ||
"oneof-union": { | ||
readonly default: "@oneOf decorator can only be used on a union or a model property which type is a union."; | ||
}; | ||
"inconsistent-shared-route-request-visibility": { | ||
@@ -250,2 +262,5 @@ readonly default: "All operations with `@sharedRoutes` must have the same `@requestVisibility`."; | ||
}[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{ | ||
"oneof-union": { | ||
readonly default: "@oneOf decorator can only be used on a union or a model property which type is a union."; | ||
}; | ||
"inconsistent-shared-route-request-visibility": { | ||
@@ -252,0 +267,0 @@ readonly default: "All operations with `@sharedRoutes` must have the same `@requestVisibility`."; |
@@ -66,2 +66,8 @@ import { createTypeSpecLibrary, paramMessage } from "@typespec/compiler"; | ||
diagnostics: { | ||
"oneof-union": { | ||
severity: "error", | ||
messages: { | ||
default: "@oneOf decorator can only be used on a union or a model property which type is a union.", | ||
}, | ||
}, | ||
"inconsistent-shared-route-request-visibility": { | ||
@@ -68,0 +74,0 @@ severity: "error", |
{ | ||
"name": "@typespec/openapi3", | ||
"version": "0.49.0-dev.10", | ||
"version": "0.49.0-dev.12", | ||
"author": "Microsoft Corporation", | ||
@@ -5,0 +5,0 @@ "description": "TypeSpec library for emitting OpenAPI 3.0 from the TypeSpec REST protocol binding", |
@@ -106,3 +106,3 @@ # @typespec/openapi3 | ||
`Union` | ||
`union Union | ModelProperty` | ||
@@ -109,0 +109,0 @@ ##### Parameters |
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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
192379
2679