Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions powershell/plugins/plugin-tweak-m4-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ async function tweakModel(state: State): Promise<PwshModel> {

handleNoinlineDirective(state);

handleDiscriminator(state);

return model;
}

Expand All @@ -40,6 +42,15 @@ function handleNoinlineDirective(state: State) {
}
}
}

function handleDiscriminator(state: State) {
for (const model of state.model.schemas.objects || []) {
if (model.discriminator) {
model.language.default['skip-inline'] = true;
}
}
}

function addResponseHeaderSchema(model: CodeModel) {
// In remodeler, each operations response headers will has its own scheam. Each header will be schema's property.
// But in m4, if 'schema' is not explicitly defined, even 'headers' is specified, there won't be a schema for headers.
Expand Down