Swagger is a specification for documenting RESTful services. Documentation can be found at https://github.com/swagger-api/swagger-spec.

This module integrates with Services (https://drupal.org/project/services) to generate swagger-parsable json documentation. Optionally, the swagger-ui library can be installed to provide a page for displaying the documentation in a user-friendly manner.

Project Page: https://www.drupal.org/sandbox/mmillford/2402571

Git clone:

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/mmillford/2402571.git swagger

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxmmillford2402571git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

mmillford’s picture

Status: Closed (won't fix) » Needs review
kunalkursija’s picture

Hi,

manual Review :

.info file
1) We must not enter 'version' into info file , Drupal does that automatically for you during release. Please read here https://www.drupal.org/node/542202#version

.install file

Suggestions :
1) if your path "/admin/structure/services/list/" is an configuration path then you can define it inside your .info file with configure parameter.
2) You should try writing drupal_set_message() inside hook_enable() rather than in hook_install().

.module file
1) I guess this should be translatable string 'name' => 'Swagger UI' inside hook_libraries_info() ?

mmillford’s picture

Thank you for taking the time to review this code.

.info file - 1) The version info has been removed since the initial commit.

.install - 1) This path isn't so much a configuration page as it is a convenient list of links. Additionally, the router location is only defined based on the existence of an optional dependency (libraries), so I think that setting it as the config path would have unintended consequences.

.install - 2) This suggestion makes sense, so I have updated the code in the repository.

.module - 1) Thank you for catching this. It has been fixed.

webcodin’s picture

Hi, the module looks good. But I have a two small wishes

swagger.module

  • 147 - Looks like here redundant empty string :)
  • 177 – You might use module_load_include('inc', 'services','services.runtime') instead module_load_include('runtime.inc', 'services');
mmillford’s picture

Thank you for the review. Both of these suggestions have been implemented.

At some point I'd like to remove the includes for services runtime, especially since that file has moved in the more recent versions of services. I'm not sure how common it is to deal with old versions of the module, however, and the check doesn't do any harm, so its still there for now.

tim_marsh’s picture

I love the idea of this module, I explored doing this for our most recent headless project, but abandoned it due to time pressure.
If theres anything I can do to help , let me know.
Just tried installing it, Can you specify the swagger ui version you used - 2.1.1 didnt seem to work

mmillford’s picture

There are two main tasks for this module right now: 1) Drupal 8 version, and 2) Support Swagger v2. I'm waiting for a D8 Services project before I work on #1, so it isn't clear when I'll be able to get to that. #2 has work started on it in the 7.x-2.x branch, but its been a while since I was able to work on it, and I don't believe its been completed. If you'd like to help with either of those, then feel free. Just submit a patch to the relevant ticket in the issue queue and I'll pull it in.

Assuming that you're on the 7.x-1.x branch, then it will only work with swagger 1.x code. Taking a quick look through their tags, the latest seems to be v1.1.15 (https://github.com/swagger-api/swagger-ui/releases/tag/v1.1.15).

i-sibbot’s picture

Automated Review

[Best practice issues identified by pareview.sh / drupalcs / coder. Please don't copy/paste all of the results unless they are short. If there are a lot, then post a link to the automated review and mention that problems should be addressed.]

Note that perfect adherence to Drupal Coding Standard is NOT a reason to block an application, except for total disregard of them. However, modules should follow them as closely as possible.

swagger.js: line 6, col 10, Error - Missing space before function parentheses. (space-before-function-paren)
swagger.js: line 12, col 13, Error - Missing space before function parentheses. (space-before-function-paren)
swagger.js: line 13, col 28, Error - "SwaggerUi" is not defined. (no-undef)
swagger.js: line 17, col 27, Error - Missing space before function parentheses. (space-before-function-paren)
swagger.js: line 17, col 50, Error - Missing space before opening brace. (space-before-blocks)
swagger.js: line 18, col 36, Error - Missing space before function parentheses. (space-before-function-paren)
swagger.js: line 18, col 44, Error - "hljs" is not defined. (no-undef)
swagger.js: line 18, col 66, Error - Missing semicolon. (semi)
swagger.js: line 20, col 26, Error - Missing space before function parentheses. (space-before-function-paren)

Not a blocker but nice to have it all linted and clean to meet coding standards.

It helps reviews to have a link to PAreview (below) in the issue header btw.

http://pareview.sh/pareview/httpgitdrupalorgsandboxmmillford2402571git

PA robot’s picture

Issue summary: View changes

Fixed the git clone URL in the issue summary for non-maintainer users.

I'm a robot and this is an automated message from Project Applications Scraper.

jwilson3’s picture

Issue summary: View changes

Automated Review

Review of the 7.x-1.x branch (commit 77ca3eb):

swagger.js: line 6, col 10, Error - Missing space before function parentheses. (space-before-function-paren)
swagger.js: line 12, col 13, Error - Missing space before function parentheses. (space-before-function-paren)
swagger.js: line 13, col 28, Error - "SwaggerUi" is not defined. (no-undef)
swagger.js: line 17, col 27, Error - Missing space before function parentheses. (space-before-function-paren)
swagger.js: line 17, col 50, Error - Missing space before opening brace. (space-before-blocks)
swagger.js: line 18, col 36, Error - Missing space before function parentheses. (space-before-function-paren)
swagger.js: line 18, col 44, Error - "hljs" is not defined. (no-undef)
swagger.js: line 18, col 66, Error - Missing semicolon. (semi)
swagger.js: line 20, col 26, Error - Missing space before function parentheses. (space-before-function-paren)

9 problems
  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.
  • This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

    Source: http://pareview.sh/ - PAReview.sh online service

    Note that perfect adherence to Drupal Coding Standard is NOT a reason to block an application, except for total disregard of them. However, modules should follow them as closely as possible.

    Manual Review

    No duplication
    Yes: Does not cause module duplication and/or fragmentation. However, this possibly duplicates an older Drupal module found on GitHub (not on Drupal.org): https://github.com/tpanagos/Drupal_SwaggerUI/ so you might consider reviewing that code to see if there is any useful functionality there that your module does not cover and include it.
    Master Branch
    Yes: Follows the guidelines for master branch.
    Licensing
    Yes: Follows the licensing requirements.
    3rd party assets/code
    Yes: Follows the guidelines for 3rd party assets/code.
    README.txt/README.md
    Yes: Follows the guidelines for in-project documentation and/or the README Template.
    Code long/complex enough for review
    Yes: Follows the guidelines for project length and complexity.
    Secure code
    Yes: Meets the security requirements.
    Coding style & Drupal API usage
    1. In your page callback you're calling drupal_add_js() twice. Two observations: 1) these can be chained together into a single function call passing an array 2) the callback appears to return what looks like a render array. Would it still work if you used '#attached' => 'js' => array() here?
    2. Instead of pointing people towards the README.txt file when enabling the module, consider implementing hook_help and providing a link to the help page.
    3. Consider using dashes in the swagger_page.tpl.php file names instead of underscores. I couldnt find a documentation page about this so can't mark this as a blocker, but the vast majority of modules and all of core templates use dashes, so this is highly recommended.

    The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

    Overall the code is very well written, I think clean up the remaining issues with the JS linter, consider my recommendations above and you're good to go.

    This review uses the Project Application Review Template.

    jwilson3’s picture

    Status: Needs review » Needs work
    klausi’s picture

    Status: Needs work » Needs review

    @jwilson3: thanks for your review! Looks like you didn't find any blocking issues, anything else or can this be RTBC instead?

    omarlopesino’s picture

    Automated Review

    Review result of 7.x-1.x branch: http://pareview.sh/pareview/httpgitdrupalorgsandboxmmillford2402571git
    There are some little things to fix.

    Manual Review

    Individual user account
    Yes, it follows.
    No duplication
    Yes, it's not duplicated
    Master Branch
    Yes, default branch 7.x-1.x is set
    Licensing
    Yes, it follows
    3rd party assets/code
    Yes, there is not third party code associated.
    README.txt/README.md
    Yes, README file exists and with properly standards.
    Code long/complex enough for review
    Yes, code is enough complex.
    Secure code
    Yes, it follows.
    Coding style & Drupal API usage

    In swagger.module, line 294, you can use drupal_strlen instead of strlen.

    I used the module and main features worked for me. I could access to swagger io json of my resources and test a endpoint using swagger ui library inside the drupal.

    omarlopesino’s picture

    Status: Needs review » Reviewed & tested by the community
    damienmckenna’s picture

    Status: Reviewed & tested by the community » Fixed

    Thanks for your contribution, Mark!

    I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

    Here are some recommended readings to help with excellent maintainership:

    You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

    Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

    Thanks to the dedicated reviewer(s) as well.

    Status: Fixed » Closed (fixed)

    Automatically closed - issue fixed for 2 weeks with no activity.