Skip to content

Commit 6d9bea6

Browse files
authored
Add Java Quickstart (#30)
1 parent 9839fd0 commit 6d9bea6

File tree

1 file changed

+85
-2
lines changed

1 file changed

+85
-2
lines changed

fern/products/sdks/overview/java/quickstart.mdx

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,89 @@ title: Java Quickstart
33
description: Get started quickly with the Fern Java SDK.
44
---
55

6-
# Java Quickstart
6+
<Markdown src="/products/sdks/snippets/demo-warning.mdx"/>
77

8-
Follow these steps to quickly get up and running with the Fern Java SDK.
8+
Generate a Java SDK by following the instructions on this page.
9+
10+
<Steps>
11+
<Markdown src="/products/sdks/snippets/install-cli.mdx"/>
12+
13+
### Initialize the Fern Folder
14+
15+
You can use either the OpenAPI definition, AsyncAPI definition, or Fern
16+
Definition to generate your SDK.
17+
18+
<AccordionGroup>
19+
<Markdown src="/products/sdks/snippets/option-1-openapi.mdx"/>
20+
21+
<Markdown src="/products/sdks/snippets/option-2-asyncapi.mdx"/>
22+
23+
<Accordion title="Option 3: Fern Definition">
24+
25+
<Markdown src="/products/sdks/snippets/option-3-fern-def.mdx"/>
26+
27+
2. Add the config option `outputSourceFiles: true` to
28+
`generators.yml`. This ensures your SDK contains source files in
29+
your preferred SDK language instead of compiled output.
30+
31+
```yaml {11-12}
32+
# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json
33+
default-group: local
34+
groups:
35+
local:
36+
generators:
37+
- name: fernapi/fern-typescript-node-sdk
38+
output:
39+
location: local-file-system
40+
path: ../sdks/typescript
41+
version: <Markdown src="/snippets/version-number.mdx"/>
42+
config:
43+
outputSourceFiles: true
44+
```
45+
46+
<Note>`fern init` creates a default configuration that includes the
47+
TypeScript Node SDK generator. The `local` group containing this
48+
generator only generates if you run fern generate without specifying a
49+
group, or if you explicitly target it with `fern generate --group
50+
local`. In subsequent steps, you'll add an additional generator for your
51+
preferred SDK language.</Note>
52+
</Accordion>
53+
54+
</AccordionGroup>
55+
56+
<Markdown src="/products/sdks/snippets/pass-fern-check.mdx"/>
57+
58+
### Add the SDK generator
59+
60+
Add the Java SDK generator:
61+
62+
```bash
63+
fern add fern-java-sdk --group sdk
64+
```
65+
66+
This command adds the following to `generators.yml`:
67+
68+
```yaml
69+
sdk:
70+
generators:
71+
- name: fernapi/fern-java-sdk
72+
version: <Markdown src="/snippets/version-number.mdx"/>
73+
output:
74+
location: local-file-system
75+
path: ../sdks/java
76+
```
77+
78+
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
79+
80+
```bash
81+
fern/ # created in step 1
82+
sdks/ # created by fern generate --group sdk
83+
├─ java
84+
├─ YourOrganizationApiClient.java
85+
├─ core/
86+
└─ resources/
87+
└─ imdb/
88+
├─ errors/
89+
└─ types/
90+
```
91+
</Steps>

0 commit comments

Comments
 (0)