How to use the @api-platform/api-doc-parser/lib/hydra/parseHydraDocumentation.getDocumentationUrlFromHeaders function in @api-platform/api-doc-parser

To help you get started, we’ve selected a few @api-platform/api-doc-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github api-platform / admin / src / hydra / fetchHydra.js View on Github external
}).then(data => {
    const status = data.response.status;

    if (status < 200 || status >= 300) {
      return promises
        .expand(data.body, {
          base: getDocumentationUrlFromHeaders(data.response.headers),
        })
        .then(json => {
          return Promise.reject(
            new HttpError(
              json[0]['http://www.w3.org/ns/hydra/core#description'][0][
                '@value'
              ],
              status,
            ),
          );
        })
        .catch(e => {
          if (e.hasOwnProperty('body')) {
            return Promise.reject(e);
          }

@api-platform/api-doc-parser

Transform an API documentation (Hydra, OpenAPI, GraphQL) in an intermediate representation that can be used for various tasks such as creating smart API clients, scaffolding code or building administration interfaces.

MIT
Latest version published 2 months ago

Package Health Score

79 / 100
Full package analysis