@typespec/openapi3 0.55.0-dev.2 → 0.55.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated-defs/TypeSpec.OpenAPI.d.ts +12 -0
- package/dist/generated-defs/TypeSpec.OpenAPI.d.ts.map +1 -0
- package/dist/generated-defs/TypeSpec.OpenAPI.js +2 -0
- package/dist/generated-defs/TypeSpec.OpenAPI.js.map +1 -0
- package/dist/generated-defs/TypeSpec.OpenAPI.ts-test.d.ts +2 -0
- package/dist/generated-defs/TypeSpec.OpenAPI.ts-test.d.ts.map +1 -0
- package/dist/generated-defs/TypeSpec.OpenAPI.ts-test.js +8 -0
- package/dist/generated-defs/TypeSpec.OpenAPI.ts-test.js.map +1 -0
- package/dist/src/decorators.d.ts +4 -3
- package/dist/src/decorators.d.ts.map +1 -1
- package/dist/src/decorators.js +4 -4
- package/dist/src/decorators.js.map +1 -1
- package/package.json +9 -8
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DecoratorContext, Model, ModelProperty, Union } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* Specify that `oneOf` should be used instead of `anyOf` for that union.
|
|
4
|
+
*/
|
|
5
|
+
export type OneOfDecorator = (context: DecoratorContext, target: Union | ModelProperty) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Specify an external reference that should be used inside of emitting this type.
|
|
8
|
+
*
|
|
9
|
+
* @param ref External reference(e.g. "../../common.json#/components/schemas/Foo")
|
|
10
|
+
*/
|
|
11
|
+
export type UseRefDecorator = (context: DecoratorContext, target: Model | ModelProperty, ref: string) => void;
|
|
12
|
+
//# sourceMappingURL=TypeSpec.OpenAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeSpec.OpenAPI.d.ts","sourceRoot":"","sources":["../../generated-defs/TypeSpec.OpenAPI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAExF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,GAAG,aAAa,KAAK,IAAI,CAAC;AAEhG;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,GAAG,aAAa,EAC7B,GAAG,EAAE,MAAM,KACR,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeSpec.OpenAPI.js","sourceRoot":"","sources":["../../generated-defs/TypeSpec.OpenAPI.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeSpec.OpenAPI.ts-test.d.ts","sourceRoot":"","sources":["../../generated-defs/TypeSpec.OpenAPI.ts-test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** An error here would mean that the decorator is not exported or doesn't have the right name. */
|
|
2
|
+
import { $oneOf, $useRef } from "@typespec/openapi3";
|
|
3
|
+
/** An error here would mean that the exported decorator is not using the same signature. Make sure to have export const $decName: DecNameDecorator = (...) => ... */
|
|
4
|
+
const _ = {
|
|
5
|
+
$oneOf,
|
|
6
|
+
$useRef,
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=TypeSpec.OpenAPI.ts-test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeSpec.OpenAPI.ts-test.js","sourceRoot":"","sources":["../../generated-defs/TypeSpec.OpenAPI.ts-test.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAQrD,qKAAqK;AACrK,MAAM,CAAC,GAAe;IACpB,MAAM;IACN,OAAO;CACR,CAAC"}
|
package/dist/src/decorators.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Program, Type } from "@typespec/compiler";
|
|
2
|
+
import { OneOfDecorator, UseRefDecorator } from "../generated-defs/TypeSpec.OpenAPI.js";
|
|
3
|
+
export declare const $useRef: UseRefDecorator;
|
|
3
4
|
export declare function getRef(program: Program, entity: Type): string | undefined;
|
|
4
|
-
export declare
|
|
5
|
+
export declare const $oneOf: OneOfDecorator;
|
|
5
6
|
export declare function getOneOf(program: Program, entity: Type): boolean;
|
|
6
7
|
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,OAAO,EAAE,IAAI,EAAS,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAIxF,eAAO,MAAM,OAAO,EAAE,eAMrB,CAAC;AAEF,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAEzE;AAGD,eAAO,MAAM,MAAM,EAAE,cAWpB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,OAAO,CAEhE"}
|
package/dist/src/decorators.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createStateSymbol, reportDiagnostic } from "./lib.js";
|
|
2
2
|
const refTargetsKey = createStateSymbol("refs");
|
|
3
|
-
export
|
|
3
|
+
export const $useRef = (context, entity, refUrl) => {
|
|
4
4
|
context.program.stateMap(refTargetsKey).set(entity, refUrl);
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
export function getRef(program, entity) {
|
|
7
7
|
return program.stateMap(refTargetsKey).get(entity);
|
|
8
8
|
}
|
|
9
9
|
const oneOfKey = createStateSymbol("oneOf");
|
|
10
|
-
export
|
|
10
|
+
export const $oneOf = (context, entity) => {
|
|
11
11
|
if (entity.kind === "ModelProperty" && entity.type.kind !== "Union") {
|
|
12
12
|
reportDiagnostic(context.program, {
|
|
13
13
|
code: "oneof-union",
|
|
@@ -15,7 +15,7 @@ export function $oneOf(context, entity) {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
context.program.stateMap(oneOfKey).set(entity, true);
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
export function getOneOf(program, entity) {
|
|
20
20
|
return program.stateMap(oneOfKey).get(entity);
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/decorators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/decorators.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE/D,MAAM,aAAa,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,OAAO,GAAoB,CACtC,OAAyB,EACzB,MAA6B,EAC7B,MAAc,EACd,EAAE;IACF,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9D,CAAC,CAAC;AAEF,MAAM,UAAU,MAAM,CAAC,OAAgB,EAAE,MAAY;IACnD,OAAO,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,MAAM,GAAmB,CACpC,OAAyB,EACzB,MAA6B,EAC7B,EAAE;IACF,IAAI,MAAM,CAAC,IAAI,KAAK,eAAe,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACpE,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE;YAChC,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE,OAAO,CAAC,eAAe;SAChC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAAY;IACrD,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/openapi3",
|
|
3
|
-
"version": "0.55.0-dev.
|
|
3
|
+
"version": "0.55.0-dev.4",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec library for emitting OpenAPI 3.0 from the TypeSpec REST protocol binding",
|
|
6
6
|
"homepage": "https://typespec.io",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"!dist/test/**"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"yaml": "~2.
|
|
41
|
+
"yaml": "~2.4.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@typespec/compiler": "~0.54.0 || >=0.55.0-dev <0.55.0",
|
|
@@ -56,19 +56,20 @@
|
|
|
56
56
|
"@typespec/openapi": "~0.54.0 || >=0.55.0-dev <0.55.0",
|
|
57
57
|
"@typespec/rest": "~0.54.0 || >=0.55.0-dev <0.55.0",
|
|
58
58
|
"@typespec/versioning": "~0.54.0 || >=0.55.0-dev <0.55.0",
|
|
59
|
-
"@vitest/coverage-v8": "^1.
|
|
60
|
-
"@vitest/ui": "^1.
|
|
59
|
+
"@vitest/coverage-v8": "^1.4.0",
|
|
60
|
+
"@vitest/ui": "^1.4.0",
|
|
61
61
|
"c8": "^9.1.0",
|
|
62
|
-
"eslint": "^8.
|
|
62
|
+
"eslint": "^8.57.0",
|
|
63
63
|
"rimraf": "~5.0.5",
|
|
64
|
-
"typescript": "~5.
|
|
65
|
-
"vitest": "^1.
|
|
64
|
+
"typescript": "~5.4.2",
|
|
65
|
+
"vitest": "^1.4.0",
|
|
66
66
|
"@typespec/tspd": "~0.46.0"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"clean": "rimraf ./dist ./temp",
|
|
70
|
-
"build": "tsc -p . && npm run lint-typespec-library",
|
|
70
|
+
"build": "npm run gen-extern-signature && tsc -p . && npm run lint-typespec-library",
|
|
71
71
|
"watch": "tsc -p . --watch",
|
|
72
|
+
"gen-extern-signature": "tspd --enable-experimental gen-extern-signature .",
|
|
72
73
|
"lint-typespec-library": "tsp compile . --warn-as-error --import @typespec/library-linter --no-emit",
|
|
73
74
|
"test": "vitest run",
|
|
74
75
|
"test:watch": "vitest -w",
|