Skip to content

Commit 9d125fc

Browse files
committed
Rever globalization of Swagger descriptions
1 parent c83f84c commit 9d125fc

File tree

3 files changed

+62
-76
lines changed

3 files changed

+62
-76
lines changed

common/models/user.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -648,12 +648,12 @@ module.exports = function(User) {
648648
UserModel.remoteMethod(
649649
'login',
650650
{
651-
description: g.f('Login a user with username/email and password.'),
651+
description: 'Login a user with username/email and password.',
652652
accepts: [
653653
{arg: 'credentials', type: 'object', required: true, http: {source: 'body'}},
654654
{arg: 'include', type: ['string'], http: {source: 'query'},
655-
description: g.f('Related objects to include in the response. ' +
656-
'See the description of return value for more details.') },
655+
description: 'Related objects to include in the response. ' +
656+
'See the description of return value for more details.' },
657657
],
658658
returns: {
659659
arg: 'accessToken', type: 'object', root: true,
@@ -671,15 +671,15 @@ module.exports = function(User) {
671671
UserModel.remoteMethod(
672672
'logout',
673673
{
674-
description: g.f('Logout a user with access token.'),
674+
description: 'Logout a user with access token.',
675675
accepts: [
676676
{arg: 'access_token', type: 'string', required: true, http: function(ctx) {
677677
var req = ctx && ctx.req;
678678
var accessToken = req && req.accessToken;
679679
var tokenID = accessToken && accessToken.id;
680680
return tokenID;
681-
}, description: g.f('Do not supply this argument, it is automatically extracted ' +
682-
'from request headers.'),
681+
}, description: 'Do not supply this argument, it is automatically extracted ' +
682+
'from request headers.',
683683
},
684684
],
685685
http: {verb: 'all'}
@@ -689,7 +689,7 @@ module.exports = function(User) {
689689
UserModel.remoteMethod(
690690
'confirm',
691691
{
692-
description: g.f('Confirm a user registration with email verification token.'),
692+
description: 'Confirm a user registration with email verification token.',
693693
accepts: [
694694
{arg: 'uid', type: 'string', required: true},
695695
{arg: 'token', type: 'string', required: true},
@@ -702,7 +702,7 @@ module.exports = function(User) {
702702
UserModel.remoteMethod(
703703
'resetPassword',
704704
{
705-
description: g.f('Reset password for a user with email.'),
705+
description: 'Reset password for a user with email.',
706706
accepts: [
707707
{arg: 'options', type: 'object', required: true, http: {source: 'body'}}
708708
],

lib/model.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
* Module Dependencies.
88
*/
99

10-
var g = require('strong-globalize')();
11-
1210
var assert = require('assert');
1311
var RemoteObjects = require('strong-remoting');
1412
var SharedClass = require('strong-remoting').SharedClass;
1513
var extend = require('util')._extend;
14+
var format = require('util').format;
1615

1716
module.exports = function(registry) {
1817

@@ -452,7 +451,7 @@ module.exports = function(registry) {
452451
http: {verb: 'get', path: '/' + pathName},
453452
accepts: {arg: 'refresh', type: 'boolean', http: {source: 'query'}},
454453
accessType: 'READ',
455-
description: g.f('Fetches belongsTo relation %s.', relationName),
454+
description: format('Fetches belongsTo relation %s.', relationName),
456455
returns: {arg: relationName, type: modelName, root: true},
457456
}, fn);
458457
};
@@ -476,7 +475,7 @@ module.exports = function(registry) {
476475
isStatic: false,
477476
http: {verb: 'get', path: '/' + pathName},
478477
accepts: {arg: 'refresh', type: 'boolean', http: {source: 'query'}},
479-
description: g.f('Fetches hasOne relation %s.', relationName),
478+
description: format('Fetches hasOne relation %s.', relationName),
480479
accessType: 'READ',
481480
returns: {arg: relationName, type: relation.modelTo.modelName, root: true},
482481
rest: {after: convertNullToNotFoundError.bind(null, toModelName)}
@@ -486,7 +485,7 @@ module.exports = function(registry) {
486485
isStatic: false,
487486
http: {verb: 'post', path: '/' + pathName},
488487
accepts: {arg: 'data', type: toModelName, http: {source: 'body'}},
489-
description: g.f('Creates a new instance in %s of this model.', relationName),
488+
description: format('Creates a new instance in %s of this model.', relationName),
490489
accessType: 'WRITE',
491490
returns: {arg: 'data', type: toModelName, root: true}
492491
});
@@ -495,15 +494,15 @@ module.exports = function(registry) {
495494
isStatic: false,
496495
http: {verb: 'put', path: '/' + pathName},
497496
accepts: {arg: 'data', type: toModelName, http: {source: 'body'}},
498-
description: g.f('Update %s of this model.', relationName),
497+
description: format('Update %s of this model.', relationName),
499498
accessType: 'WRITE',
500499
returns: {arg: 'data', type: toModelName, root: true}
501500
});
502501

503502
define('__destroy__' + relationName, {
504503
isStatic: false,
505504
http: {verb: 'delete', path: '/' + pathName},
506-
description: g.f('Deletes %s of this model.', relationName),
505+
description: format('Deletes %s of this model.', relationName),
507506
accessType: 'WRITE',
508507
});
509508
};
@@ -517,10 +516,10 @@ module.exports = function(registry) {
517516
isStatic: false,
518517
http: {verb: 'get', path: '/' + pathName + '/:fk'},
519518
accepts: {arg: 'fk', type: 'any',
520-
description: g.f('Foreign key for %s', relationName),
519+
description: format('Foreign key for %s', relationName),
521520
required: true,
522521
http: {source: 'path'}},
523-
description: g.f('Find a related item by id for %s.', relationName),
522+
description: format('Find a related item by id for %s.', relationName),
524523
accessType: 'READ',
525524
returns: {arg: 'result', type: toModelName, root: true},
526525
rest: {after: convertNullToNotFoundError.bind(null, toModelName)}
@@ -531,10 +530,10 @@ module.exports = function(registry) {
531530
isStatic: false,
532531
http: {verb: 'delete', path: '/' + pathName + '/:fk'},
533532
accepts: { arg: 'fk', type: 'any',
534-
description: g.f('Foreign key for %s', relationName),
533+
description: format('Foreign key for %s', relationName),
535534
required: true,
536535
http: {source: 'path'}},
537-
description: g.f('Delete a related item by id for %s.', relationName),
536+
description: format('Delete a related item by id for %s.', relationName),
538537
accessType: 'WRITE',
539538
returns: []
540539
}, destroyByIdFunc);
@@ -545,12 +544,12 @@ module.exports = function(registry) {
545544
http: {verb: 'put', path: '/' + pathName + '/:fk'},
546545
accepts: [
547546
{arg: 'fk', type: 'any',
548-
description: g.f('Foreign key for %s', relationName),
547+
description: format('Foreign key for %s', relationName),
549548
required: true,
550549
http: { source: 'path' }},
551550
{arg: 'data', type: toModelName, http: {source: 'body'}},
552551
],
553-
description: g.f('Update a related item by id for %s.', relationName),
552+
description: format('Update a related item by id for %s.', relationName),
554553
accessType: 'WRITE',
555554
returns: {arg: 'result', type: toModelName, root: true}
556555
}, updateByIdFunc);
@@ -569,10 +568,10 @@ module.exports = function(registry) {
569568
isStatic: false,
570569
http: {verb: 'put', path: '/' + pathName + '/rel/:fk'},
571570
accepts: [{ arg: 'fk', type: 'any',
572-
description: g.f('Foreign key for %s', relationName),
571+
description: format('Foreign key for %s', relationName),
573572
required: true,
574573
http: {source: 'path'}}].concat(accepts),
575-
description: g.f('Add a related item by id for %s.', relationName),
574+
description: format('Add a related item by id for %s.', relationName),
576575
accessType: 'WRITE',
577576
returns: {arg: relationName, type: modelThrough.modelName, root: true}
578577
}, addFunc);
@@ -582,10 +581,10 @@ module.exports = function(registry) {
582581
isStatic: false,
583582
http: {verb: 'delete', path: '/' + pathName + '/rel/:fk'},
584583
accepts: {arg: 'fk', type: 'any',
585-
description: g.f('Foreign key for %s', relationName),
584+
description: format('Foreign key for %s', relationName),
586585
required: true,
587586
http: {source: 'path'}},
588-
description: g.f('Remove the %s relation to an item by id.', relationName),
587+
description: format('Remove the %s relation to an item by id.', relationName),
589588
accessType: 'WRITE',
590589
returns: []
591590
}, removeFunc);
@@ -597,10 +596,10 @@ module.exports = function(registry) {
597596
isStatic: false,
598597
http: {verb: 'head', path: '/' + pathName + '/rel/:fk'},
599598
accepts: {arg: 'fk', type: 'any',
600-
description: g.f('Foreign key for %s', relationName),
599+
description: format('Foreign key for %s', relationName),
601600
required: true,
602601
http: {source: 'path'}},
603-
description: g.f('Check the existence of %s relation to an item by id.', relationName),
602+
description: format('Check the existence of %s relation to an item by id.', relationName),
604603
accessType: 'READ',
605604
returns: {arg: 'exists', type: 'boolean', root: true},
606605
rest: {
@@ -643,7 +642,7 @@ module.exports = function(registry) {
643642
isStatic: isStatic,
644643
http: {verb: 'get', path: '/' + pathName},
645644
accepts: {arg: 'filter', type: 'object'},
646-
description: g.f('Queries %s of %s.', scopeName, this.modelName),
645+
description: format('Queries %s of %s.', scopeName, this.modelName),
647646
accessType: 'READ',
648647
returns: {arg: scopeName, type: [toModelName], root: true}
649648
});
@@ -652,24 +651,24 @@ module.exports = function(registry) {
652651
isStatic: isStatic,
653652
http: {verb: 'post', path: '/' + pathName},
654653
accepts: {arg: 'data', type: toModelName, http: {source: 'body'}},
655-
description: g.f('Creates a new instance in %s of this model.', scopeName),
654+
description: format('Creates a new instance in %s of this model.', scopeName),
656655
accessType: 'WRITE',
657656
returns: {arg: 'data', type: toModelName, root: true}
658657
});
659658

660659
define('__delete__' + scopeName, {
661660
isStatic: isStatic,
662661
http: {verb: 'delete', path: '/' + pathName},
663-
description: g.f('Deletes all %s of this model.', scopeName),
662+
description: format('Deletes all %s of this model.', scopeName),
664663
accessType: 'WRITE',
665664
});
666665

667666
define('__count__' + scopeName, {
668667
isStatic: isStatic,
669668
http: {verb: 'get', path: '/' + pathName + '/count'},
670669
accepts: {arg: 'where', type: 'object',
671-
description: g.f('Criteria to match model instances')},
672-
description: g.f('Counts %s of %s.', scopeName, this.modelName),
670+
description: 'Criteria to match model instances'},
671+
description: format('Counts %s of %s.', scopeName, this.modelName),
673672
accessType: 'READ',
674673
returns: {arg: 'count', type: 'number'}
675674
});
@@ -718,7 +717,7 @@ module.exports = function(registry) {
718717
acceptArgs = [
719718
{
720719
arg: paramName, type: 'any', http: { source: 'path' },
721-
description: g.f('Foreign key for %s.', relation.name),
720+
description: format('Foreign key for %s.', relation.name),
722721
required: true,
723722
},
724723
];

0 commit comments

Comments
 (0)