Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 07f2ed3

Browse files
committed
chore(readme): refactor usage example with await and destructure all available properties
1 parent 9153a60 commit 07f2ed3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎README.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ Using [Bun](https://bun.sh/):
5555
```javascript
5656
import { parseHydraDocumentation } from "@api-platform/api-doc-parser";
5757

58-
parseHydraDocumentation("https://demo.api-platform.com").then(({ api }) =>
59-
console.log(api),
58+
const{ api, response, status } =awaitparseHydraDocumentation(
59+
"https://demo.api-platform.com",
6060
);
6161
```
6262

@@ -65,8 +65,8 @@ parseHydraDocumentation("https://demo.api-platform.com").then(({ api }) =>
6565
```javascript
6666
import { parseSwaggerDocumentation } from "@api-platform/api-doc-parser";
6767

68-
parseSwaggerDocumentation("https://demo.api-platform.com/docs.json").then(
69-
({ api }) =>console.log(api),
68+
const { api, response, status } =awaitparseSwaggerDocumentation(
69+
"https://demo.api-platform.com/docs.json",
7070
);
7171
```
7272

@@ -75,18 +75,18 @@ parseSwaggerDocumentation("https://demo.api-platform.com/docs.json").then(
7575
```javascript
7676
import { parseOpenApi3Documentation } from "@api-platform/api-doc-parser";
7777

78-
parseOpenApi3Documentation(
78+
const { api, response, status } =awaitparseOpenApi3Documentation(
7979
"https://demo.api-platform.com/docs.jsonopenapi?spec_version=3.0.0",
80-
).then(({ api }) =>console.log(api));
80+
);
8181
```
8282

8383
**GraphQL**
8484

8585
```javascript
8686
import { parseGraphQl } from "@api-platform/api-doc-parser";
8787

88-
parseGraphQl("https://demo.api-platform.com/graphql").then(({ api }) =>
89-
console.log(api),
88+
const{ api, response } =awaitparseGraphQl(
89+
"https://demo.api-platform.com/graphql",
9090
);
9191
```
9292

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /