Skip to content

Commit 7932d75

Browse files
committed
Revert globalization of Swagger descriptions
1 parent 6c9df36 commit 7932d75

File tree

3 files changed

+60
-72
lines changed

3 files changed

+60
-72
lines changed

common/models/user.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -660,12 +660,12 @@ module.exports = function(User) {
660660
UserModel.remoteMethod(
661661
'login',
662662
{
663-
description: g.f('Login a user with username/email and password.'),
663+
description: 'Login a user with username/email and password.',
664664
accepts: [
665665
{arg: 'credentials', type: 'object', required: true, http: {source: 'body'}},
666666
{arg: 'include', type: ['string'], http: {source: 'query'},
667-
description: g.f('Related objects to include in the response. ' +
668-
'See the description of return value for more details.') },
667+
description: 'Related objects to include in the response. ' +
668+
'See the description of return value for more details.' },
669669
],
670670
returns: {
671671
arg: 'accessToken', type: 'object', root: true,
@@ -683,15 +683,15 @@ module.exports = function(User) {
683683
UserModel.remoteMethod(
684684
'logout',
685685
{
686-
description: g.f('Logout a user with access token.'),
686+
description: 'Logout a user with access token.',
687687
accepts: [
688688
{arg: 'access_token', type: 'string', required: true, http: function(ctx) {
689689
var req = ctx && ctx.req;
690690
var accessToken = req && req.accessToken;
691691
var tokenID = accessToken && accessToken.id;
692692
return tokenID;
693-
}, description: g.f('Do not supply this argument, it is automatically extracted ' +
694-
'from request headers.'),
693+
}, description: 'Do not supply this argument, it is automatically extracted ' +
694+
'from request headers.',
695695
},
696696
],
697697
http: {verb: 'all'}
@@ -701,7 +701,7 @@ module.exports = function(User) {
701701
UserModel.remoteMethod(
702702
'confirm',
703703
{
704-
description: g.f('Confirm a user registration with email verification token.'),
704+
description: 'Confirm a user registration with email verification token.',
705705
accepts: [
706706
{arg: 'uid', type: 'string', required: true},
707707
{arg: 'token', type: 'string', required: true},
@@ -714,7 +714,7 @@ module.exports = function(User) {
714714
UserModel.remoteMethod(
715715
'resetPassword',
716716
{
717-
description: g.f('Reset password for a user with email.'),
717+
description: 'Reset password for a user with email.',
718718
accepts: [
719719
{arg: 'options', type: 'object', required: true, http: {source: 'body'}}
720720
],

lib/model.js

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var assert = require('assert');
1313
var RemoteObjects = require('strong-remoting');
1414
var SharedClass = require('strong-remoting').SharedClass;
1515
var extend = require('util')._extend;
16+
var format = require('util').format;
1617

1718
module.exports = function(registry) {
1819

@@ -452,7 +453,7 @@ module.exports = function(registry) {
452453
http: {verb: 'get', path: '/' + pathName},
453454
accepts: {arg: 'refresh', type: 'boolean', http: {source: 'query'}},
454455
accessType: 'READ',
455-
description: g.f('Fetches belongsTo relation %s.', relationName),
456+
description: format('Fetches belongsTo relation %s.', relationName),
456457
returns: {arg: relationName, type: modelName, root: true},
457458
}, fn);
458459
};
@@ -476,7 +477,7 @@ module.exports = function(registry) {
476477
isStatic: false,
477478
http: {verb: 'get', path: '/' + pathName},
478479
accepts: {arg: 'refresh', type: 'boolean', http: {source: 'query'}},
479-
description: g.f('Fetches hasOne relation %s.', relationName),
480+
description: format('Fetches hasOne relation %s.', relationName),
480481
accessType: 'READ',
481482
returns: {arg: relationName, type: relation.modelTo.modelName, root: true},
482483
rest: {after: convertNullToNotFoundError.bind(null, toModelName)}
@@ -486,7 +487,7 @@ module.exports = function(registry) {
486487
isStatic: false,
487488
http: {verb: 'post', path: '/' + pathName},
488489
accepts: {arg: 'data', type: toModelName, http: {source: 'body'}},
489-
description: g.f('Creates a new instance in %s of this model.', relationName),
490+
description: format('Creates a new instance in %s of this model.', relationName),
490491
accessType: 'WRITE',
491492
returns: {arg: 'data', type: toModelName, root: true}
492493
});
@@ -495,15 +496,15 @@ module.exports = function(registry) {
495496
isStatic: false,
496497
http: {verb: 'put', path: '/' + pathName},
497498
accepts: {arg: 'data', type: toModelName, http: {source: 'body'}},
498-
description: g.f('Update %s of this model.', relationName),
499+
description: format('Update %s of this model.', relationName),
499500
accessType: 'WRITE',
500501
returns: {arg: 'data', type: toModelName, root: true}
501502
});
502503

503504
define('__destroy__' + relationName, {
504505
isStatic: false,
505506
http: {verb: 'delete', path: '/' + pathName},
506-
description: g.f('Deletes %s of this model.', relationName),
507+
description: format('Deletes %s of this model.', relationName),
507508
accessType: 'WRITE',
508509
});
509510
};
@@ -517,10 +518,10 @@ module.exports = function(registry) {
517518
isStatic: false,
518519
http: {verb: 'get', path: '/' + pathName + '/:fk'},
519520
accepts: {arg: 'fk', type: 'any',
520-
description: g.f('Foreign key for %s', relationName),
521+
description: format('Foreign key for %s', relationName),
521522
required: true,
522523
http: {source: 'path'}},
523-
description: g.f('Find a related item by id for %s.', relationName),
524+
description: format('Find a related item by id for %s.', relationName),
524525
accessType: 'READ',
525526
returns: {arg: 'result', type: toModelName, root: true},
526527
rest: {after: convertNullToNotFoundError.bind(null, toModelName)}
@@ -531,10 +532,10 @@ module.exports = function(registry) {
531532
isStatic: false,
532533
http: {verb: 'delete', path: '/' + pathName + '/:fk'},
533534
accepts: { arg: 'fk', type: 'any',
534-
description: g.f('Foreign key for %s', relationName),
535+
description: format('Foreign key for %s', relationName),
535536
required: true,
536537
http: {source: 'path'}},
537-
description: g.f('Delete a related item by id for %s.', relationName),
538+
description: format('Delete a related item by id for %s.', relationName),
538539
accessType: 'WRITE',
539540
returns: []
540541
}, destroyByIdFunc);
@@ -545,12 +546,12 @@ module.exports = function(registry) {
545546
http: {verb: 'put', path: '/' + pathName + '/:fk'},
546547
accepts: [
547548
{arg: 'fk', type: 'any',
548-
description: g.f('Foreign key for %s', relationName),
549+
description: format('Foreign key for %s', relationName),
549550
required: true,
550551
http: { source: 'path' }},
551552
{arg: 'data', type: toModelName, http: {source: 'body'}},
552553
],
553-
description: g.f('Update a related item by id for %s.', relationName),
554+
description: format('Update a related item by id for %s.', relationName),
554555
accessType: 'WRITE',
555556
returns: {arg: 'result', type: toModelName, root: true}
556557
}, updateByIdFunc);
@@ -569,10 +570,10 @@ module.exports = function(registry) {
569570
isStatic: false,
570571
http: {verb: 'put', path: '/' + pathName + '/rel/:fk'},
571572
accepts: [{ arg: 'fk', type: 'any',
572-
description: g.f('Foreign key for %s', relationName),
573+
description: format('Foreign key for %s', relationName),
573574
required: true,
574575
http: {source: 'path'}}].concat(accepts),
575-
description: g.f('Add a related item by id for %s.', relationName),
576+
description: format('Add a related item by id for %s.', relationName),
576577
accessType: 'WRITE',
577578
returns: {arg: relationName, type: modelThrough.modelName, root: true}
578579
}, addFunc);
@@ -582,10 +583,10 @@ module.exports = function(registry) {
582583
isStatic: false,
583584
http: {verb: 'delete', path: '/' + pathName + '/rel/:fk'},
584585
accepts: {arg: 'fk', type: 'any',
585-
description: g.f('Foreign key for %s', relationName),
586+
description: format('Foreign key for %s', relationName),
586587
required: true,
587588
http: {source: 'path'}},
588-
description: g.f('Remove the %s relation to an item by id.', relationName),
589+
description: format('Remove the %s relation to an item by id.', relationName),
589590
accessType: 'WRITE',
590591
returns: []
591592
}, removeFunc);
@@ -597,10 +598,10 @@ module.exports = function(registry) {
597598
isStatic: false,
598599
http: {verb: 'head', path: '/' + pathName + '/rel/:fk'},
599600
accepts: {arg: 'fk', type: 'any',
600-
description: g.f('Foreign key for %s', relationName),
601+
description: format('Foreign key for %s', relationName),
601602
required: true,
602603
http: {source: 'path'}},
603-
description: g.f('Check the existence of %s relation to an item by id.', relationName),
604+
description: format('Check the existence of %s relation to an item by id.', relationName),
604605
accessType: 'READ',
605606
returns: {arg: 'exists', type: 'boolean', root: true},
606607
rest: {
@@ -643,7 +644,7 @@ module.exports = function(registry) {
643644
isStatic: isStatic,
644645
http: {verb: 'get', path: '/' + pathName},
645646
accepts: {arg: 'filter', type: 'object'},
646-
description: g.f('Queries %s of %s.', scopeName, this.modelName),
647+
description: format('Queries %s of %s.', scopeName, this.modelName),
647648
accessType: 'READ',
648649
returns: {arg: scopeName, type: [toModelName], root: true}
649650
});
@@ -652,24 +653,24 @@ module.exports = function(registry) {
652653
isStatic: isStatic,
653654
http: {verb: 'post', path: '/' + pathName},
654655
accepts: {arg: 'data', type: toModelName, http: {source: 'body'}},
655-
description: g.f('Creates a new instance in %s of this model.', scopeName),
656+
description: format('Creates a new instance in %s of this model.', scopeName),
656657
accessType: 'WRITE',
657658
returns: {arg: 'data', type: toModelName, root: true}
658659
});
659660

660661
define('__delete__' + scopeName, {
661662
isStatic: isStatic,
662663
http: {verb: 'delete', path: '/' + pathName},
663-
description: g.f('Deletes all %s of this model.', scopeName),
664+
description: format('Deletes all %s of this model.', scopeName),
664665
accessType: 'WRITE',
665666
});
666667

667668
define('__count__' + scopeName, {
668669
isStatic: isStatic,
669670
http: {verb: 'get', path: '/' + pathName + '/count'},
670671
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),
672+
description: 'Criteria to match model instances'},
673+
description: format('Counts %s of %s.', scopeName, this.modelName),
673674
accessType: 'READ',
674675
returns: {arg: 'count', type: 'number'}
675676
});
@@ -718,7 +719,7 @@ module.exports = function(registry) {
718719
acceptArgs = [
719720
{
720721
arg: paramName, type: 'any', http: { source: 'path' },
721-
description: g.f('Foreign key for %s.', relation.name),
722+
description: format('Foreign key for %s.', relation.name),
722723
required: true,
723724
},
724725
];

0 commit comments

Comments
 (0)