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

[Prototype] EZP-26309: Prototype the usage of REST Embedding in PlatformUI #79

Closed
wants to merge 2 commits into from

Conversation

dpobel
Copy link
Contributor

@dpobel dpobel commented Oct 12, 2016

@ezrobot
Copy link

ezrobot commented Oct 12, 2016

yuidoc reports the following documentation warnings:

YUIDoc found 1 lint errors in your docs
#1 replacing incorrect tag: parma with param  src/services/ContentService.js:563

@@ -565,15 +565,21 @@ define(["structures/ContentCreateStruct", "structures/ContentUpdateStruct", "str
*
* @method loadUserDrafts
* @param userId {String} target user identifier (e.g. "/api/ezp/v2/user/users/14")
* @parma [headers] {Object} additional headers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should specify it acts as callback if callback is not set for bc, same below :)

Copy link
Contributor Author

@dpobel dpobel Oct 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the [ and ] around headers means the parameter is not mandatory so that's kind of implied but to be honest, the documentation was not really my main purpose here :-)
That said, this is a good point because we could also do the same thing by keeping 2 parameters on the method and allowing the first one to be an option object:

/**
  * bla bla
  *
  * @param {String|Object} options the userId or an object containing the userId and others options
  * @param {String} options.userId
  * @param {Object} options.headers additional headers
  * @param {Function} callback
  */
ContentService.prototype.loadUserDrafts = function (options, callback) {
    var userId = options, headers = {};

    if ( typeof options === "object" ) {
        userId = options.userId;
        headers = options.headers || headers;
    }
    // ...
};

and I'm not really sure which approach is the best

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 1, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@dpobel dpobel closed this Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants