Lowercase attributes' names on API generated through the CLI

This commit is contained in:
Aurelsicoko 2017-10-11 12:08:04 +02:00
parent 038c8ec29b
commit f8cebb98f4
7 changed files with 11 additions and 9 deletions

View File

@ -83,15 +83,16 @@ module.exports = (scope, cb) => {
} }
return { return {
name: _.trim(_.deburr(_.camelCase(parts[0]).toLowerCase())), name: _.trim(_.deburr(_.lowerCase(parts[0]).toLowerCase())),
params: { params: {
type: _.trim(_.deburr(_.camelCase(parts[1]).toLowerCase())) type: _.trim(_.deburr(_.lowerCase(parts[1]).toLowerCase()))
} }
}; };
} else { } else {
return _.has(attribute, 'params.type') ? attribute : undefined; return _.has(attribute, 'params.type') ? attribute : undefined;
} }
}); });
scope.attributes = _.compact(scope.attributes); scope.attributes = _.compact(scope.attributes);
// Handle invalid action arguments. // Handle invalid action arguments.

View File

@ -1,13 +1,16 @@
{ {
"connection": "<%= connection %>", "connection": "<%= connection %>",
"description": "<%= description %>",
"collectionName": "<%= collectionName || idPluralized %>", "collectionName": "<%= collectionName || idPluralized %>",
"info": {
"name": "<%= id %>",
"description": "<%= description %>"
},
"options": { "options": {
"increments": true, "increments": true,
"timestamps": true, "timestamps": true,
"comment": "" "comment": ""
}, },
"attributes": { "attributes": {
<%= attributes %> <%= attributes %>
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"file":"vendor.dll.js","sources":["webpack:///vendor.dll.js"],"mappings":"AAAA;;;;;AA4PA;;;;;;;;;;;;;;AA8lIA","sourceRoot":""} {"version":3,"file":"vendor.dll.js","sources":["webpack:///vendor.dll.js"],"mappings":"AAAA;;;;;AAwPA;;;;;;;;;;;;;;AAslIA","sourceRoot":""}

View File

@ -3,7 +3,6 @@
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const _ = require('lodash'); const _ = require('lodash');
const send = require('koa-send');
const Service = require('../services/ContentTypeBuilder'); const Service = require('../services/ContentTypeBuilder');

View File

@ -3,7 +3,6 @@
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
const _ = require('lodash'); const _ = require('lodash');
const send = require('koa-send');
module.exports = { module.exports = {
menu: async ctx => { menu: async ctx => {