@api-platform/api-doc-parser
Advanced tools
Comparing version 0.16.2 to 0.16.3
import { Api } from "../Api.js"; | ||
import type { OpenAPIV3 } from "openapi-types"; | ||
import type { RequestInitExtended } from "./types"; | ||
export interface ParsedOpenApi3Documentation { | ||
@@ -8,3 +9,3 @@ api: Api; | ||
} | ||
export default function parseOpenApi3Documentation(entrypointUrl: string): Promise<ParsedOpenApi3Documentation>; | ||
export default function parseOpenApi3Documentation(entrypointUrl: string, options?: RequestInitExtended): Promise<ParsedOpenApi3Documentation>; | ||
//# sourceMappingURL=parseOpenApi3Documentation.d.ts.map |
import { Api } from "../Api.js"; | ||
import handleJson, { removeTrailingSlash } from "./handleJson.js"; | ||
export default function parseOpenApi3Documentation(entrypointUrl) { | ||
export default function parseOpenApi3Documentation(entrypointUrl, options = {}) { | ||
entrypointUrl = removeTrailingSlash(entrypointUrl); | ||
return fetch(entrypointUrl) | ||
let headers = typeof options.headers === "function" ? options.headers() : options.headers; | ||
headers = new Headers(headers); | ||
headers.append("Accept", "application/vnd.openapi+json"); | ||
return fetch(entrypointUrl, Object.assign(Object.assign({}, options), { headers: headers })) | ||
.then((res) => Promise.all([res, res.json()])) | ||
@@ -7,0 +10,0 @@ .then(([res, response]) => { |
{ | ||
"name": "@api-platform/api-doc-parser", | ||
"version": "0.16.2", | ||
"version": "0.16.3", | ||
"description": "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.", | ||
@@ -5,0 +5,0 @@ "files": [ |
import { Api } from "../Api.js"; | ||
import handleJson, { removeTrailingSlash } from "./handleJson.js"; | ||
import type { OpenAPIV3 } from "openapi-types"; | ||
import type { RequestInitExtended } from "./types"; | ||
@@ -12,6 +13,12 @@ export interface ParsedOpenApi3Documentation { | ||
export default function parseOpenApi3Documentation( | ||
entrypointUrl: string | ||
entrypointUrl: string, | ||
options: RequestInitExtended = {} | ||
): Promise<ParsedOpenApi3Documentation> { | ||
entrypointUrl = removeTrailingSlash(entrypointUrl); | ||
return fetch(entrypointUrl) | ||
let headers: HeadersInit | undefined = | ||
typeof options.headers === "function" ? options.headers() : options.headers; | ||
headers = new Headers(headers); | ||
headers.append("Accept", "application/vnd.openapi+json"); | ||
return fetch(entrypointUrl, { ...options, headers: headers }) | ||
.then((res) => Promise.all([res, res.json()])) | ||
@@ -18,0 +25,0 @@ .then( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
278043
148
7102