Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

Improve javascript example #1

Description

@jpadilla

Looking to improve a bit the readability on the javascript snippets to something like this. Thoughts?

var coreapi = window.coreapi;

// Initialize a client & load the schema document
var client = new coreapi.Client();
var url = 'http://petstore.swagger.io/v2/swagger.json';

client.get(url)
  .then(function(document) {
    // Interact with the API endpoint
    var action = ['pet', 'addPet'];
    var params = {
      category: ...,
      status: ...,
      name: ...,
      tags: ...,
      photoUrls: ...,
      id: ...
    };

    return client.action(document, action, params=params);
  })
  .then(function(result) {
    // Return value is in 'result'
    console.log(result);
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions