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

javascript-es6: use default exports for api and model classes #916

Merged
merged 3 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import superagent from "superagent";
* @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}ApiClient
* @class
*/{{/emitJSDoc}}
export class ApiClient {
export default class ApiClient {
constructor() {
{{#emitJSDoc}}/**
* The base URL against which to resolve every API call's (relative) path.
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/handlebars/javascript/es6/api.mustache
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{{>licenseInfo}}
import {{braces "left"}}ApiClient{{braces "right"}} from "../ApiClient";
{{#imports}}import {{braces "left"}}{{import}}{{braces "right"}} from '../{{#modelPackage}}{{&modelPackage}}/{{/modelPackage}}{{import}}';
import ApiClient from "../ApiClient";
{{#imports}}import {{import}} from '../{{#modelPackage}}{{&modelPackage}}/{{/modelPackage}}{{import}}';
{{/imports}}

{{#emitJSDoc}}/**
* {{baseName}} service.
* @module {{#invokerPackage}}{{&invokerPackage}}/{{/invokerPackage}}{{#apiPackage}}{{&apiPackage}}/{{/apiPackage}}{{classname}}
* @version {{projectVersion}}
*/{{/emitJSDoc}}
export class {{classname}} {
export default class {{classname}} {

{{#emitJSDoc}}/**
* Constructs a new {{&classname}}. {{#description}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @enum {{braces "left"}}{{datatype}}{{braces "right"}}
* @readonly
*/{{/emitJSDoc}}
export {{datatypeWithEnum}} = {
export default {{datatypeWithEnum}} = {
{{#allowableValues}}
{{#enumVars}}
{{#emitJSDoc}}
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/handlebars/javascript/es6/index.mustache
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{>licenseInfo}}
import {ApiClient} from './ApiClient';
{{#models}}import {{braces "left"}}{{#model}}{{classFilename}}{{/model}}{{braces "right"}} from './{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{importPath}}';
{{/models}}{{#apiInfo}}{{#apis}}import {{braces "left"}}{{importPath}}{{braces "right"}} from './{{#apiPackage}}{{apiPackage}}/{{/apiPackage}}{{importPath}}';
import ApiClient from './ApiClient';
{{#models}}import {{#model}}{{classFilename}}{{/model}} from './{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{importPath}}';
{{/models}}{{#apiInfo}}{{#apis}}import {{importPath}} from './{{#apiPackage}}{{apiPackage}}/{{/apiPackage}}{{importPath}}';
{{/apis}}{{/apiInfo}}

{{#emitJSDoc}}/**{{#projectDescription}}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/handlebars/javascript/es6/model.mustache
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{>licenseInfo}}
import {{braces "left"}}ApiClient{{braces "right"}} from '../ApiClient';
import ApiClient from '../ApiClient';
{{#imports}}
import {{braces "left"}}{{import}}{{braces "right"}} from './{{import}}';
import {{import}} from './{{import}}';
{{/imports}}

{{#models}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ const {{classname}} = {
}
};

export {{braces "left"}}{{classname}}{{braces "right"}};
export default {{braces "left"}}{{classname}}{{braces "right"}};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @version {{projectVersion}}
*/
{{/emitJSDoc}}
export class {{classname}} {{#parentModel}}extends {{classname}} {{/parentModel}}{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}}extends Array {{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{
export default class {{classname}} {{#parentModel}}extends {{classname}} {{/parentModel}}{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}}extends Array {{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{
{{#emitJSDoc}}
/**
* Constructs a new <code>{{classname}}</code>.{{#description}}
Expand Down
Loading