add always-create-content-type-parameter option, enable checker by default
This commit is contained in:
Родитель
c3aa799c92
Коммит
365fc60af4
|
@ -39,7 +39,7 @@ export class Checker {
|
|||
|
||||
const types = values(<Schema[]>this.codeModel.schemas.objects).concat(values(this.codeModel.schemas.groups)).concat(values(this.codeModel.schemas.choices)).concat(values(this.codeModel.schemas.sealedChoices)).toArray()
|
||||
for (const dupe of values(types).duplicates(each => each.language.default.name)) {
|
||||
this.session.error(`Duplicate Object Schema '${dupe}' detected.`, []);
|
||||
this.session.error(`Object schemas with '${dupe}' name detected.`, []);
|
||||
};
|
||||
|
||||
/* for (const dupe of values(this.codeModel.schemas.numbers).select(each => each.type).duplicates()) {
|
||||
|
@ -48,13 +48,12 @@ export class Checker {
|
|||
}
|
||||
|
||||
process() {
|
||||
if (this.options['additional-checks'] === true) {
|
||||
if (this.options['additional-checks'] !== false) {
|
||||
this.checkOperationGroups();
|
||||
|
||||
this.checkOperations();
|
||||
|
||||
this.checkSchemas();
|
||||
|
||||
}
|
||||
return this.codeModel;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ export class ModelerFour {
|
|||
private profileFilter!: Array<string>;
|
||||
private apiVersionFilter!: Array<string>;
|
||||
private schemaCache = new ProcessingCache((schema: OpenAPI.Schema, name: string) => this.processSchemaImpl(schema, name));
|
||||
private options: Dictionary<any> = {};
|
||||
|
||||
constructor(protected session: Session<oai3>) {
|
||||
this.input = session.model;// shadow(session.model, filename);
|
||||
|
@ -137,6 +138,8 @@ export class ModelerFour {
|
|||
}
|
||||
|
||||
async init() {
|
||||
this.options = await this.session.getValue('modelerfour', {});
|
||||
|
||||
// grab override-client-name
|
||||
const newTitle = await this.session.getValue('override-client-name', '');
|
||||
if (newTitle) {
|
||||
|
@ -998,7 +1001,7 @@ export class ModelerFour {
|
|||
}
|
||||
});
|
||||
|
||||
if (http.mediaTypes.length > 1) {
|
||||
if (this.options[`always-create-content-type-parameter`] === true || http.mediaTypes.length > 1) {
|
||||
// we have multiple media types
|
||||
// make sure we have an enum for the content-type
|
||||
// and add a content type parameter to the request
|
||||
|
|
|
@ -133,6 +133,10 @@ modelerfour:
|
|||
# defaults to false
|
||||
additional-checks: false|true
|
||||
|
||||
# always create the content-type parameter for binary requests
|
||||
# when it's only one possible value, make it a constant.
|
||||
always-create-content-type-parameter: true
|
||||
|
||||
# customization of the identifier normalization and naming provided by the prenamer.
|
||||
# pascal|pascalcase - MultiWordIdentifier
|
||||
# camel|camelcase - multiWordIdentifier
|
||||
|
|
|
@ -5027,7 +5027,7 @@
|
|||
"required": true,
|
||||
"x-ms-parameter-location": "method"
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче