@azure-tools/typespec-java 0.20.0 → 0.20.1
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/src/code-model-builder.d.ts +0 -1
- package/dist/src/code-model-builder.d.ts.map +1 -1
- package/dist/src/code-model-builder.js +113 -103
- package/dist/src/code-model-builder.js.map +1 -1
- package/dist/src/common/schemas/usage.d.ts +2 -2
- package/dist/src/common/schemas/usage.d.ts.map +1 -1
- package/dist/src/common/schemas/usage.js +2 -2
- package/dist/src/common/schemas/usage.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/target/emitter.jar +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-model-builder.d.ts","sourceRoot":"","sources":["../../src/code-model-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAIT,YAAY,EACZ,aAAa,EAeb,YAAY,EAEZ,YAAY,EAEZ,SAAS,EAKT,MAAM,EAMN,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAwBL,OAAO,
|
|
1
|
+
{"version":3,"file":"code-model-builder.d.ts","sourceRoot":"","sources":["../../src/code-model-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAIT,YAAY,EACZ,aAAa,EAeb,YAAY,EAEZ,YAAY,EAEZ,SAAS,EAKT,MAAM,EAMN,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAwBL,OAAO,EASR,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,WAAW,EAMX,OAAO,EACP,IAAI,EAEJ,KAAK,EAUN,MAAM,oBAAoB,CAAC;AAoB5B,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAQnD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAiB9C,OAAO,EACL,eAAe,EAShB,MAAM,iBAAiB,CAAC;AAWzB,qBAAa,gBAAgB;I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AC,aAAa,CAAC,CAAe;IACrC,IAAI,YAAY,IAAI,YAAY,CAO/B;IAED,OAAO,CAAC,cAAc,CAAC,CAAgB;IACvC,IAAI,aAAa,IAAI,aAAa,CAKjC;IAED,OAAO,CAAC,UAAU,CAAC,CAAY;IAC/B,IAAI,SAAS,IAAI,SAAS,CAEzB;IAED,OAAO,CAAC,aAAa,CAAC,CAAe;IACrC,IAAI,YAAY,IAAI,YAAY,CAE/B;IAED,OAAO,CAAC,iBAAiB,CAAC,CAAe;IACzC,IAAI,gBAAgB,IAAI,YAAY,CAKnC;IAED,OAAO,CAAC,yBAAyB;IA8BjC,OAAO,CAAC,oBAAoB,CAAC,CAAY;IACzC,IAAI,mBAAmB,IAAI,SAAS,CAKnC;IAED,OAAO,CAAC,0BAA0B,CAAC,CAAY;IAC/C,IAAI,yBAAyB,IAAI,SAAS,CAMzC;IAED,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,uBAAuB;IAwB/B,OAAO,CAAC,sBAAsB,CAAC,CAAY;IAE3C,OAAO,CAAC,oBAAoB;IA+E5B,OAAO,CAAC,gBAAgB;IAyBxB,OAAO,CAAC,KAAK;CAGd"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AnySchema, ApiVersion, ArraySchema, BinaryResponse, BinarySchema, BooleanSchema, ByteArraySchema, ChoiceValue, DateSchema, DateTimeSchema, DictionarySchema, Discriminator, GroupProperty, GroupSchema, HttpHeader, HttpParameter, ImplementationLocation, KeySecurityScheme, Language, Metadata, NumberSchema, OAuth2SecurityScheme, ObjectSchema, OperationGroup, Parameter, ParameterLocation, Property, Relations, Response, SchemaResponse, SchemaType, Security, SerializationStyle, StringSchema, TimeSchema, UnixTimeSchema, UriSchema, VirtualParameter, } from "@autorest/codemodel";
|
|
2
2
|
import { KnownMediaType } from "@azure-tools/codegen";
|
|
3
|
-
import {
|
|
3
|
+
import { createSdkContext, getAllModels, getClientType, getWireName, isApiVersion, isSdkBuiltInKind, isSdkIntKind, } from "@azure-tools/typespec-client-generator-core";
|
|
4
4
|
import { getDoc, getEffectiveModelType, getNamespaceFullName, getOverloadedOperation, getSummary, getVisibility, isArrayModelType, isRecordModelType, listServices, } from "@typespec/compiler";
|
|
5
|
-
import { Visibility, getAuthentication, getHeaderFieldName, getPathParamName, getQueryParamName,
|
|
5
|
+
import { Visibility, getAuthentication, getHeaderFieldName, getPathParamName, getQueryParamName, isHeader, isPathParam, isQueryParam, } from "@typespec/http";
|
|
6
6
|
import { getSegment } from "@typespec/rest";
|
|
7
7
|
import { getAddedOnVersions } from "@typespec/versioning";
|
|
8
8
|
import { fail } from "assert";
|
|
@@ -274,11 +274,16 @@ export class CodeModelBuilder {
|
|
|
274
274
|
schemaUsage.splice(index, 1);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
// Internal on
|
|
278
|
-
if (schemaUsage === null || schemaUsage === void 0 ? void 0 : schemaUsage.includes(SchemaContext.
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
277
|
+
// Internal on PublicSpread, but Public takes precedence
|
|
278
|
+
if (schemaUsage === null || schemaUsage === void 0 ? void 0 : schemaUsage.includes(SchemaContext.PublicSpread)) {
|
|
279
|
+
// remove PublicSpread as it now served its purpose
|
|
280
|
+
schemaUsage.splice(schemaUsage.indexOf(SchemaContext.PublicSpread), 1);
|
|
281
|
+
// Public would override PublicSpread, hence do nothing if this schema is Public
|
|
282
|
+
if (!(schemaUsage === null || schemaUsage === void 0 ? void 0 : schemaUsage.includes(SchemaContext.Public))) {
|
|
283
|
+
// set the model as Internal, so that it is not exposed to user
|
|
284
|
+
if (!schemaUsage.includes(SchemaContext.Internal)) {
|
|
285
|
+
schemaUsage.push(SchemaContext.Internal);
|
|
286
|
+
}
|
|
282
287
|
}
|
|
283
288
|
}
|
|
284
289
|
}
|
|
@@ -944,7 +949,7 @@ export class CodeModelBuilder {
|
|
|
944
949
|
}
|
|
945
950
|
}
|
|
946
951
|
processParameterBody(op, rawHttpOperation, sdkHttpOperation, sdkBody) {
|
|
947
|
-
var _a;
|
|
952
|
+
var _a, _b, _c;
|
|
948
953
|
// set contentTypes to mediaTypes
|
|
949
954
|
op.requests[0].protocol.http.mediaTypes = sdkBody.contentTypes;
|
|
950
955
|
const unknownRequestBody = op.requests[0].protocol.http.mediaTypes &&
|
|
@@ -969,97 +974,112 @@ export class CodeModelBuilder {
|
|
|
969
974
|
},
|
|
970
975
|
});
|
|
971
976
|
op.addParameter(parameter);
|
|
977
|
+
const jsonMergePatch = operationIsJsonMergePatch(sdkHttpOperation);
|
|
978
|
+
const schemaIsPublicBeforeProcess = schema instanceof ObjectSchema && ((_b = schema.usage) === null || _b === void 0 ? void 0 : _b.includes(SchemaContext.Public));
|
|
972
979
|
this.trackSchemaUsage(schema, { usage: [SchemaContext.Input] });
|
|
973
980
|
if (op.convenienceApi) {
|
|
974
981
|
// model/schema does not need to be Public or Internal, if it is not to be used in convenience API
|
|
975
982
|
this.trackSchemaUsage(schema, { usage: [op.internalApi ? SchemaContext.Internal : SchemaContext.Public] });
|
|
976
983
|
}
|
|
977
|
-
if (
|
|
984
|
+
if (jsonMergePatch) {
|
|
978
985
|
this.trackSchemaUsage(schema, { usage: [SchemaContext.JsonMergePatch] });
|
|
979
986
|
}
|
|
980
987
|
if (op.convenienceApi && operationIsMultipart(sdkHttpOperation)) {
|
|
981
988
|
this.trackSchemaUsage(schema, { serializationFormats: [KnownMediaType.Multipart] });
|
|
982
989
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
//
|
|
987
|
-
const
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
if (
|
|
992
|
-
//
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
990
|
+
if (op.convenienceApi) {
|
|
991
|
+
// Explicit body parameter @body or @bodyRoot would result to the existance of rawHttpOperation.parameters.body.property
|
|
992
|
+
// Implicit body parameter would result to rawHttpOperation.parameters.body.property be undefined
|
|
993
|
+
// see https://typespec.io/docs/libraries/http/cheat-sheet#data-types
|
|
994
|
+
const bodyParameterFlatten = schema instanceof ObjectSchema &&
|
|
995
|
+
sdkType.kind === "model" &&
|
|
996
|
+
!((_c = rawHttpOperation.parameters.body) === null || _c === void 0 ? void 0 : _c.property) &&
|
|
997
|
+
!this.isArm();
|
|
998
|
+
if (schema instanceof ObjectSchema && bodyParameterFlatten) {
|
|
999
|
+
// flatten body parameter
|
|
1000
|
+
const parameters = sdkHttpOperation.parameters;
|
|
1001
|
+
const bodyParameter = sdkHttpOperation.bodyParam;
|
|
1002
|
+
if (!parameter.language.default.name) {
|
|
1003
|
+
// name the parameter for documentation
|
|
1004
|
+
parameter.language.default.name = "request";
|
|
1005
|
+
}
|
|
1006
|
+
if (jsonMergePatch) {
|
|
1007
|
+
// skip model flatten, if "application/merge-patch+json"
|
|
1008
|
+
if (sdkType.isGeneratedName) {
|
|
1009
|
+
schema.language.default.name = pascalCase(op.language.default.name) + "PatchRequest";
|
|
1010
|
+
}
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
const schemaUsage = schema.usage;
|
|
1014
|
+
if (!schemaIsPublicBeforeProcess && (schemaUsage === null || schemaUsage === void 0 ? void 0 : schemaUsage.includes(SchemaContext.Public))) {
|
|
1015
|
+
// Public added in this op, change it to PublicSpread
|
|
1016
|
+
// This means that if this op would originally add Public to this schema, it adds PublicSpread instead
|
|
1017
|
+
schemaUsage === null || schemaUsage === void 0 ? void 0 : schemaUsage.splice(schemaUsage === null || schemaUsage === void 0 ? void 0 : schemaUsage.indexOf(SchemaContext.Public), 1);
|
|
1018
|
+
this.trackSchemaUsage(schema, { usage: [SchemaContext.PublicSpread] });
|
|
1011
1019
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1020
|
+
if (op.convenienceApi && op.parameters) {
|
|
1021
|
+
op.convenienceApi.requests = [];
|
|
1022
|
+
const request = new Request({
|
|
1023
|
+
protocol: op.requests[0].protocol,
|
|
1024
|
+
});
|
|
1025
|
+
request.parameters = [];
|
|
1026
|
+
op.convenienceApi.requests.push(request);
|
|
1027
|
+
// header/query/path params
|
|
1028
|
+
for (const opParameter of parameters) {
|
|
1029
|
+
this.addParameterOrBodyPropertyToCodeModelRequest(opParameter, op, request, schema, parameter);
|
|
1030
|
+
}
|
|
1031
|
+
// body param
|
|
1032
|
+
if (bodyParameter) {
|
|
1033
|
+
if (bodyParameter.type.kind === "model") {
|
|
1034
|
+
for (const bodyProperty of bodyParameter.type.properties) {
|
|
1035
|
+
if (bodyProperty.kind === "property") {
|
|
1036
|
+
this.addParameterOrBodyPropertyToCodeModelRequest(bodyProperty, op, request, schema, parameter);
|
|
1037
|
+
}
|
|
1018
1038
|
}
|
|
1019
1039
|
}
|
|
1020
1040
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1041
|
+
request.signatureParameters = request.parameters;
|
|
1042
|
+
if (request.signatureParameters.length > 6) {
|
|
1043
|
+
// create an option bag
|
|
1044
|
+
const name = op.language.default.name + "Options";
|
|
1045
|
+
const namespace = getNamespace(rawHttpOperation.operation);
|
|
1046
|
+
// option bag schema
|
|
1047
|
+
const optionBagSchema = this.codeModel.schemas.add(new GroupSchema(name, `Options for ${op.language.default.name} API`, {
|
|
1048
|
+
language: {
|
|
1049
|
+
default: {
|
|
1050
|
+
namespace: namespace,
|
|
1051
|
+
},
|
|
1052
|
+
java: {
|
|
1053
|
+
namespace: this.getJavaNamespace(namespace),
|
|
1054
|
+
},
|
|
1035
1055
|
},
|
|
1036
|
-
},
|
|
1037
|
-
}));
|
|
1038
|
-
request.parameters.forEach((it) => {
|
|
1039
|
-
optionBagSchema.add(new GroupProperty(it.language.default.name, it.language.default.description, it.schema, {
|
|
1040
|
-
originalParameter: [it],
|
|
1041
|
-
summary: it.summary,
|
|
1042
|
-
required: it.required,
|
|
1043
|
-
nullable: it.nullable,
|
|
1044
|
-
readOnly: false,
|
|
1045
|
-
serializedName: it.language.default.serializedName,
|
|
1046
1056
|
}));
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1057
|
+
request.parameters.forEach((it) => {
|
|
1058
|
+
optionBagSchema.add(new GroupProperty(it.language.default.name, it.language.default.description, it.schema, {
|
|
1059
|
+
originalParameter: [it],
|
|
1060
|
+
summary: it.summary,
|
|
1061
|
+
required: it.required,
|
|
1062
|
+
nullable: it.nullable,
|
|
1063
|
+
readOnly: false,
|
|
1064
|
+
serializedName: it.language.default.serializedName,
|
|
1065
|
+
}));
|
|
1066
|
+
});
|
|
1067
|
+
this.trackSchemaUsage(optionBagSchema, { usage: [SchemaContext.Input] });
|
|
1068
|
+
if (op.convenienceApi) {
|
|
1069
|
+
this.trackSchemaUsage(optionBagSchema, {
|
|
1070
|
+
usage: [op.internalApi ? SchemaContext.Internal : SchemaContext.Public],
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
// option bag parameter
|
|
1074
|
+
const optionBagParameter = new Parameter("options", optionBagSchema.language.default.description, optionBagSchema, {
|
|
1075
|
+
implementation: ImplementationLocation.Method,
|
|
1076
|
+
required: true,
|
|
1077
|
+
nullable: false,
|
|
1052
1078
|
});
|
|
1079
|
+
request.signatureParameters = [optionBagParameter];
|
|
1080
|
+
request.parameters.forEach((it) => (it.groupedBy = optionBagParameter));
|
|
1081
|
+
request.parameters.push(optionBagParameter);
|
|
1053
1082
|
}
|
|
1054
|
-
// option bag parameter
|
|
1055
|
-
const optionBagParameter = new Parameter("options", optionBagSchema.language.default.description, optionBagSchema, {
|
|
1056
|
-
implementation: ImplementationLocation.Method,
|
|
1057
|
-
required: true,
|
|
1058
|
-
nullable: false,
|
|
1059
|
-
});
|
|
1060
|
-
request.signatureParameters = [optionBagParameter];
|
|
1061
|
-
request.parameters.forEach((it) => (it.groupedBy = optionBagParameter));
|
|
1062
|
-
request.parameters.push(optionBagParameter);
|
|
1063
1083
|
}
|
|
1064
1084
|
}
|
|
1065
1085
|
}
|
|
@@ -1745,25 +1765,6 @@ export class CodeModelBuilder {
|
|
|
1745
1765
|
return getWireName(this.sdkContext, target);
|
|
1746
1766
|
}
|
|
1747
1767
|
}
|
|
1748
|
-
getParameterLocation(target) {
|
|
1749
|
-
if (isHeader(this.program, target)) {
|
|
1750
|
-
return ParameterLocation.Header;
|
|
1751
|
-
}
|
|
1752
|
-
else if (isQueryParam(this.program, target)) {
|
|
1753
|
-
return ParameterLocation.Query;
|
|
1754
|
-
}
|
|
1755
|
-
else if (isPathParam(this.program, target)) {
|
|
1756
|
-
return ParameterLocation.Path;
|
|
1757
|
-
}
|
|
1758
|
-
else if (isBody(this.program, target) ||
|
|
1759
|
-
isBodyRoot(this.program, target) ||
|
|
1760
|
-
isMultipartBodyProperty(this.program, target)) {
|
|
1761
|
-
return ParameterLocation.Body;
|
|
1762
|
-
}
|
|
1763
|
-
else {
|
|
1764
|
-
return "BodyProperty";
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
1768
|
isReadOnly(target) {
|
|
1768
1769
|
const segment = target.__raw ? getSegment(this.program, target.__raw) !== undefined : false;
|
|
1769
1770
|
if (segment) {
|
|
@@ -1921,7 +1922,7 @@ export class CodeModelBuilder {
|
|
|
1921
1922
|
return this._subscriptionParameter;
|
|
1922
1923
|
}
|
|
1923
1924
|
propagateSchemaUsage(schema) {
|
|
1924
|
-
var _a, _b;
|
|
1925
|
+
var _a, _b, _c, _d;
|
|
1925
1926
|
const processedSchemas = new Set();
|
|
1926
1927
|
const innerApplySchemaUsage = (schema, schemaUsage) => {
|
|
1927
1928
|
this.trackSchemaUsage(schema, schemaUsage);
|
|
@@ -1977,9 +1978,18 @@ export class CodeModelBuilder {
|
|
|
1977
1978
|
}
|
|
1978
1979
|
};
|
|
1979
1980
|
// Exclude context that not to be propagated
|
|
1981
|
+
const updatedSchemaUsage = (_a = schema.usage) === null || _a === void 0 ? void 0 : _a.filter((it) => it !== SchemaContext.Paged && it !== SchemaContext.PublicSpread);
|
|
1982
|
+
const indexSpread = (_b = schema.usage) === null || _b === void 0 ? void 0 : _b.indexOf(SchemaContext.PublicSpread);
|
|
1983
|
+
if (updatedSchemaUsage &&
|
|
1984
|
+
indexSpread &&
|
|
1985
|
+
indexSpread >= 0 &&
|
|
1986
|
+
!((_c = schema.usage) === null || _c === void 0 ? void 0 : _c.includes(SchemaContext.Public))) {
|
|
1987
|
+
// Propagate Public, if schema is PublicSpread
|
|
1988
|
+
updatedSchemaUsage.push(SchemaContext.Public);
|
|
1989
|
+
}
|
|
1980
1990
|
const schemaUsage = {
|
|
1981
|
-
usage:
|
|
1982
|
-
serializationFormats: (
|
|
1991
|
+
usage: updatedSchemaUsage,
|
|
1992
|
+
serializationFormats: (_d = schema.serializationFormats) === null || _d === void 0 ? void 0 : _d.filter((it) => it !== KnownMediaType.Multipart),
|
|
1983
1993
|
};
|
|
1984
1994
|
// Propagate the usage of the initial schema itself
|
|
1985
1995
|
innerPropagateSchemaUsage(schema, schemaUsage);
|