Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add response type text #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pm-Egor-Genning
Copy link

No description provided.

lib/codegen.ts Outdated
});

// tslint:disable-next-line
this.engine.registerHelper('concat', (...values) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why typescript without types?

lib/codegen.ts Outdated
}
});

this.engine.registerHelper('assign', function (varName, varValue, options) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure should be immutable. No assign allowed

lib/codegen.ts Outdated
@@ -30,7 +30,23 @@ export class Codegen {
return Case.pascal(value);
});

this.engine.registerHelper('concat', (...values: string[]) => {
this.engine.registerHelper('if_eq', function(a, b, opts) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for? Use {#if (eq? a b)}

{{#case "application/json"}}
{{assign 'responseType' 'json'}}
{{/case}}
{{#case "text/csv"}}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too strict should me some match against MIME top class

{{#if @first}}
{{#with (deref this)}}{{#first content}}{{#switch @key}}
{{#case "application/json"}}
{{assign 'responseType' 'json'}}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need to have assign here. Just put two conditional blocks below:
one for including <any> and one for defining responseType

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants