turn on poly-resource by default
This commit is contained in:
Родитель
52638c73aa
Коммит
b70db1a58d
|
@ -101,8 +101,8 @@ cli:
|
||||||
# prop: propertyName
|
# prop: propertyName
|
||||||
# flatten: true
|
# flatten: true
|
||||||
polymorphism:
|
polymorphism:
|
||||||
expand-as-resource: false
|
expand-as-resource: true
|
||||||
auto-parameter-hidden: true
|
auto-parameter-hidden: false
|
||||||
naming:
|
naming:
|
||||||
cli:
|
cli:
|
||||||
appliedTo:
|
appliedTo:
|
||||||
|
|
|
@ -340,20 +340,20 @@ export class Helper {
|
||||||
`${NEW_LINE}${tab(2)}operations:${NEW_LINE}`.concat(
|
`${NEW_LINE}${tab(2)}operations:${NEW_LINE}`.concat(
|
||||||
v.operations.map(vv =>
|
v.operations.map(vv =>
|
||||||
`${tab(2)}- operationName: ${generateCliValue(vv, 3)}` +
|
`${tab(2)}- operationName: ${generateCliValue(vv, 3)}` +
|
||||||
(isNullOrUndefined(NodeHelper.getPolyAsResourceParam(vv)) ? '' : `${NEW_LINE}${tab(3)}polyAsResourceParam: ${NodeHelper.getCliKey(NodeHelper.getPolyAsResourceParam(vv), '<missing-clikey>')}`) +
|
(isNullOrUndefined(NodeHelper.getPolyAsResourceParam(vv)) ? '' : `${NEW_LINE}${tab(3)}cli-poly-as-resource-subclass-param: ${NodeHelper.getCliKey(NodeHelper.getPolyAsResourceParam(vv), '<missing-clikey>')}`) +
|
||||||
`${NEW_LINE}${tab(3)}parameters:${NEW_LINE}`.concat(
|
`${NEW_LINE}${tab(3)}parameters:${NEW_LINE}`.concat(
|
||||||
vv.parameters.map(vvv => `${tab(3)}- parameterName: ${generateCliValue(vvv, 4)}${generatePropertyFlattenValue(vvv, 4)}${generateDiscriminatorValueForParam(vvv, 4)}${NEW_LINE}` +
|
vv.parameters.map(vvv => `${tab(3)}- parameterName: ${generateCliValue(vvv, 4)}${generatePropertyFlattenValue(vvv, 4)}${generateDiscriminatorValueForParam(vvv, 4)}${NEW_LINE}` +
|
||||||
(isNullOrUndefined(NodeHelper.getPolyAsResourceBaseSchema(vvv)) ? '' : `${tab(4)}polyAsResourceBaseSchema: ${NodeHelper.getCliKey(NodeHelper.getPolyAsResourceBaseSchema(vvv), '<baseSchemaCliKeyMissing>')}${NEW_LINE}`) +
|
(isNullOrUndefined(NodeHelper.getPolyAsResourceBaseSchema(vvv)) ? '' : `${tab(4)}cli-poly-as-resource-base-schema: ${NodeHelper.getCliKey(NodeHelper.getPolyAsResourceBaseSchema(vvv), '<baseSchemaCliKeyMissing>')}${NEW_LINE}`) +
|
||||||
(isNullOrUndefined(NodeHelper.getPolyAsParamBaseSchema(vvv)) ? '' : `${tab(4)}polyAsParamBaseSchema: ${NodeHelper.getCliKey(NodeHelper.getPolyAsParamBaseSchema(vvv), '<baseSchemaCliKeyMissing>')}${NEW_LINE}`) +
|
(isNullOrUndefined(NodeHelper.getPolyAsParamBaseSchema(vvv)) ? '' : `${tab(4)}cli-poly-as-param-base-schema: ${NodeHelper.getCliKey(NodeHelper.getPolyAsParamBaseSchema(vvv), '<baseSchemaCliKeyMissing>')}${NEW_LINE}`) +
|
||||||
(isNullOrUndefined(NodeHelper.getPolyAsParamOriginalParam(vvv)) ? '' : `${tab(4)}polyAsParamOriginalParam: ${NodeHelper.getCliKey(NodeHelper.getPolyAsParamOriginalParam(vvv), '<oriParamCliKeyMissing>')}${NEW_LINE}`) +
|
(isNullOrUndefined(NodeHelper.getPolyAsParamOriginalParam(vvv)) ? '' : `${tab(4)}cli-poly-as-param-expanded: ${NodeHelper.getCliKey(NodeHelper.getPolyAsParamOriginalParam(vvv), '<oriParamCliKeyMissing>')}${NEW_LINE}`) +
|
||||||
(((!isNullOrUndefined(vvv.protocol?.http?.in)) && vvv.protocol.http.in === 'body')
|
(((!isNullOrUndefined(vvv.protocol?.http?.in)) && vvv.protocol.http.in === 'body')
|
||||||
? `${tab(4)}bodySchema: ${vvv.schema.language.default.name}${NEW_LINE}` : '')).join('')) +
|
? `${tab(4)}bodySchema: ${vvv.schema.language.default.name}${NEW_LINE}` : '')).join('')) +
|
||||||
vv.requests.map((req, index) =>
|
vv.requests.map((req, index) =>
|
||||||
isNullOrUndefined(req.parameters) ? '' :
|
isNullOrUndefined(req.parameters) ? '' :
|
||||||
req.parameters.map((vvv) => `${tab(3)}- parameterName[${index}]: ${generateCliValue(vvv, 4)}${generatePropertyFlattenValue(vvv, 4)}${generateDiscriminatorValueForParam(vvv, 4)}${NEW_LINE}` +
|
req.parameters.map((vvv) => `${tab(3)}- parameterName[${index}]: ${generateCliValue(vvv, 4)}${generatePropertyFlattenValue(vvv, 4)}${generateDiscriminatorValueForParam(vvv, 4)}${NEW_LINE}` +
|
||||||
(isNullOrUndefined(NodeHelper.getPolyAsResourceBaseSchema(vvv)) ? '' : `${tab(4)}polyAsResourceBaseSchema: ${NodeHelper.getCliKey(NodeHelper.getPolyAsResourceBaseSchema(vvv), '<baseSchemaCliKeyMissing>')}${NEW_LINE}`) +
|
(isNullOrUndefined(NodeHelper.getPolyAsResourceBaseSchema(vvv)) ? '' : `${tab(4)}cli-poly-as-resource-base-schema: ${NodeHelper.getCliKey(NodeHelper.getPolyAsResourceBaseSchema(vvv), '<baseSchemaCliKeyMissing>')}${NEW_LINE}`) +
|
||||||
(isNullOrUndefined(NodeHelper.getPolyAsParamBaseSchema(vvv)) ? '' : `${tab(4)}polyAsParamBaseSchema: ${NodeHelper.getCliKey(NodeHelper.getPolyAsParamBaseSchema(vvv), '<baseSchemaCliKeyMissing>')}${NEW_LINE}`) +
|
(isNullOrUndefined(NodeHelper.getPolyAsParamBaseSchema(vvv)) ? '' : `${tab(4)}cli-poly-as-param-base-schema: ${NodeHelper.getCliKey(NodeHelper.getPolyAsParamBaseSchema(vvv), '<baseSchemaCliKeyMissing>')}${NEW_LINE}`) +
|
||||||
(isNullOrUndefined(NodeHelper.getPolyAsParamOriginalParam(vvv)) ? '' : `${tab(4)}polyAsParamOriginalParam: ${NodeHelper.getCliKey(NodeHelper.getPolyAsParamOriginalParam(vvv), '<oriParamCliKeyMissing>')}${NEW_LINE}`) +
|
(isNullOrUndefined(NodeHelper.getPolyAsParamOriginalParam(vvv)) ? '' : `${tab(4)}cli-poly-as-param-expanded: ${NodeHelper.getCliKey(NodeHelper.getPolyAsParamOriginalParam(vvv), '<oriParamCliKeyMissing>')}${NEW_LINE}`) +
|
||||||
(((!isNullOrUndefined(vvv.protocol?.http?.in)) && vvv.protocol.http.in === 'body')
|
(((!isNullOrUndefined(vvv.protocol?.http?.in)) && vvv.protocol.http.in === 'body')
|
||||||
? `${tab(4)}bodySchema: ${vvv.schema.language.default.name}${NEW_LINE}` : '')).join(''))
|
? `${tab(4)}bodySchema: ${vvv.schema.language.default.name}${NEW_LINE}` : '')).join(''))
|
||||||
).join(''))
|
).join(''))
|
||||||
|
|
|
@ -19,7 +19,7 @@ export class NodeHelper {
|
||||||
private static readonly POLY_AS_RESOURCE_BASE_SCHEMA = 'cli-poly-as-resource-base-schema';
|
private static readonly POLY_AS_RESOURCE_BASE_SCHEMA = 'cli-poly-as-resource-base-schema';
|
||||||
private static readonly POLY_AS_PARAM_BASE_SCHEMA = 'cli-poly-as-param-base-schema';
|
private static readonly POLY_AS_PARAM_BASE_SCHEMA = 'cli-poly-as-param-base-schema';
|
||||||
private static readonly POLY_AS_PARAM_ORIGINIAL_PARAMETER = 'cli-poly-as-param-original-parameter';
|
private static readonly POLY_AS_PARAM_ORIGINIAL_PARAMETER = 'cli-poly-as-param-original-parameter';
|
||||||
private static readonly POLY_AS_PARAM_EXPANDED = 'cli-poly-asparam-expanded';
|
private static readonly POLY_AS_PARAM_EXPANDED = 'cli-poly-as-param-expanded';
|
||||||
|
|
||||||
private static visitedKeyDict = {};
|
private static visitedKeyDict = {};
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,9 @@ export async function processRequest(host: Host) {
|
||||||
let rd = new PolyAsResourceModifier(session);
|
let rd = new PolyAsResourceModifier(session);
|
||||||
rd.process();
|
rd.process();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Helper.logWarning("cli.polymorphism.expand-as-resource is not true, poly-resource will be ignored");
|
||||||
|
}
|
||||||
|
|
||||||
Helper.dumper.dumpCodeModel('poly-as-resource-post');
|
Helper.dumper.dumpCodeModel('poly-as-resource-post');
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче