mean-expert-official / loopback-sdk-builder

Tool for auto-generating Software Development Kits (SDKs) for LoopBack
Other
399 stars 178 forks source link

Problem on generating services for Rest Connector? #609

Open PhilippeCorreges opened 6 years ago

PhilippeCorreges commented 6 years ago

What type of issue are you creating?

What version of this module are you using?

Write other if any: 2.3.1 as using angular 6.0.3

Please add a description for your issue:

I have a server side model like: { "name": "etablissement", "plural": "etablissements", "base": "Model", "idInjection": true, "options": { "validateUpsert": true }, "properties": {}, "validations": [], "relations": {}, "acls": [], "methods": {} }

"etablissement": { "dataSource": "etablissementREST", "public": true },

"etablissementREST": { "name": "etablissementREST", "crud": false, "connector": "rest", "debug": false, "options": { "headers": { "accept": "application/json", "content-type": "application/json" }, "strictSSL": false }, "operations": [ { "template": { "method": "GET", "url": "https://data.education.gouv.fr/api/records/1.0/search/?dataset=fr-en-adresse-et-geolocalisation-etablissements-premier-et-second-degre", "query": { "dataset": "{dataset}" }, "options": { "strictSSL": true, "useQuerystring": true }, "responsePath": "$.records.*" }, "functions": { "/": [] } } ] }

and when I use my ng serve, I am getting a lot of error (Only on this model):

ERROR in src/app/shared/sdk/services/custom/Etablissement.ts(46,10): error T S1005: ';' expected. src/app/shared/sdk/services/custom/Etablissement.ts(46,11): error TS1161: Un terminated regular expression literal. src/app/shared/sdk/services/custom/Etablissement.ts(55,3): error TS1128: Dec laration or statement expected. src/app/shared/sdk/services/custom/Etablissement.ts(72,3): error TS1128: Dec laration or statement expected. src/app/shared/sdk/services/custom/Etablissement.ts(72,24): error TS1005: ', ' expected. src/app/shared/sdk/services/custom/Etablissement.ts(72,50): error TS1109: Ex pression expected. src/app/shared/sdk/services/custom/Etablissement.ts(72,61): error TS1005: '; ' expected. src/app/shared/sdk/services/custom/Etablissement.ts(73,9): error TS1005: ':' expected. src/app/shared/sdk/services/custom/Etablissement.ts(73,16): error TS1005: ', ' expected. src/app/shared/sdk/services/custom/Etablissement.ts(73,33): error TS1005: ', ' expected. src/app/shared/sdk/services/custom/Etablissement.ts(74,9): error TS1005: ':' expected. src/app/shared/sdk/services/custom/Etablissement.ts(74,13): error TS1005: ',

` public invoke(request: any = {}, customHeaders?: Function): Observable { let _method: string = "POST"; let _url: string = LoopBackConfig.getPath() + "/" + LoopBackConfig.getApiVersion() + "/etablissements/invoke"; let _routeParams: any = {}; let _postBody: any = { request: request }; let _urlParams: any = {}; let result = this.request(_method, _url, _routeParams, _urlParams, _postBody, null, customHeaders); return result; }

/**

Any idea ??

Thanks to all.

PhilippeCorreges commented 6 years ago

Just retried the SDK generation... It mainly adds a / like here: public /(dataset: any = {}, q: any = {}, customHeaders?: Function): Observable {

I do not think it grabs a comment or something else as all is ok server side.

Hope this helps.