-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2145e30
commit 9a30ad9
Showing
25 changed files
with
3,244 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Specify files that shouldn't be modified by Fern |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: ci | ||
|
||
on: [push] | ||
|
||
jobs: | ||
compile: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up go | ||
uses: actions/setup-go@v4 | ||
|
||
- name: Compile | ||
run: go build ./... | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up go | ||
uses: actions/setup-go@v4 | ||
|
||
- name: Test | ||
run: go test ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name: generator-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
types: | ||
FeatureId: | ||
docs: | | ||
A unique identifier for a feature (e.g. OPTIONALS). This is typed as a freeform string | ||
to allow for arbitrary features, but callers are expected to use the FeatureType | ||
string representation whenever possible. | ||
type: string | ||
|
||
FeatureType: | ||
docs: | | ||
Unique identifiers for features that can be demonstrated with snippets. | ||
enum: | ||
- AUTHENTICATION | ||
- ERRORS | ||
- USAGE | ||
- PAGINATION | ||
- RETRIES | ||
- REQUEST_OPTIONS | ||
- STREAMING | ||
- TIMEOUTS | ||
|
||
FeatureConfig: | ||
docs: | | ||
The configuration used to specify a generator's set of supported features. | ||
This is static data associated with a particular version of a generator, and | ||
is expected to be written as a static features.yml file in the generator's | ||
repository. | ||
properties: | ||
features: list<FeatureSpec> | ||
|
||
FeatureSpec: | ||
docs: | | ||
A specification for a feature supported by a generator. This includes the | ||
feature's ID, a description, and any additional information that should be | ||
included in the README.md. | ||
properties: | ||
id: FeatureId | ||
description: optional<string> | ||
addendum: optional<string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
imports: | ||
feature: feature.yml | ||
types: | ||
ReadmeConfig: | ||
docs: | | ||
The configuration used to generate a README.md file. | ||
The information described here is a combination of user-defined information | ||
(i.e. specified in the generators.yml), and dynamically generated information | ||
that comes from each generator (i.e. features, requirements, and more). | ||
properties: | ||
language: LanguageInfo | ||
organization: string | ||
bannerLink: optional<string> | ||
docsLink: optional<string> | ||
requirements: optional<list<string>> | ||
features: | ||
docs: | | ||
Specifies the list of features supported by a specific generator. | ||
The features are rendered in the order they're specified. | ||
type: optional<list<ReadmeFeature>> | ||
|
||
ReadmeFeature: | ||
docs: | | ||
A single feature supported by a generator (e.g. PAGINATION). | ||
properties: | ||
id: feature.FeatureId | ||
description: optional<string> | ||
addendum: optional<string> | ||
snippets: optional<list<string>> | ||
snippetsAreOptional: | ||
docs: | | ||
If true, the feature block should be rendered even if we don't receive a snippet for it. | ||
This is useful for features that are always supported, but might not require a snippet | ||
to explain. | ||
type: boolean | ||
|
||
LanguageInfo: | ||
docs: | | ||
The language and its associated publish information (if any). | ||
This is used to generate badges, the installation guide, and determine what language to | ||
use when surrounding the snippets in a code block. | ||
union: | ||
typescript: TypescriptInfo | ||
python: PythonInfo | ||
go: GoInfo | ||
java: JavaInfo | ||
ruby: RubyInfo | ||
csharp: CsharpInfo | ||
|
||
TypescriptInfo: | ||
properties: | ||
title: literal<"TypeScript"> | ||
format: literal<"ts"> | ||
publishInfo: optional<NpmPublishInfo> | ||
|
||
PythonInfo: | ||
properties: | ||
title: literal<"Python"> | ||
format: literal<"python"> | ||
publishInfo: optional<PypiPublishInfo> | ||
|
||
GoInfo: | ||
properties: | ||
title: literal<"Go"> | ||
format: literal<"go"> | ||
publishInfo: optional<GoPublishInfo> | ||
|
||
JavaInfo: | ||
properties: | ||
title: literal<"Java"> | ||
format: literal<"java"> | ||
publishInfo: optional<MavenPublishInfo> | ||
|
||
RubyInfo: | ||
properties: | ||
title: literal<"Ruby"> | ||
format: literal<"ruby"> | ||
publishInfo: optional<RubyGemsPublishInfo> | ||
|
||
CsharpInfo: | ||
properties: | ||
title: literal<"C#"> | ||
format: literal<"csharp"> | ||
publishInfo: optional<NugetPublishInfo> | ||
|
||
NpmPublishInfo: | ||
properties: | ||
packageName: string | ||
|
||
PypiPublishInfo: | ||
properties: | ||
packageName: string | ||
|
||
GoPublishInfo: | ||
properties: | ||
owner: string | ||
repo: string | ||
version: string | ||
|
||
MavenPublishInfo: | ||
properties: | ||
artifact: string | ||
group: string | ||
version: string | ||
|
||
RubyGemsPublishInfo: | ||
properties: | ||
packageName: string | ||
|
||
NugetPublishInfo: | ||
properties: | ||
packageName: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"organization" : "fern", | ||
"version" : "0.0.23" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
default-group: local | ||
groups: | ||
local: | ||
generators: | ||
- name: fernapi/fern-typescript-node-sdk | ||
version: 0.12.8-rc0 | ||
output: | ||
location: local-file-system | ||
path: ../../../packages/generator-cli/src/configuration/generated | ||
config: | ||
noSerdeLayer: true | ||
outputSourceFiles: true | ||
neverThrowErrors: true | ||
timeoutInSeconds: infinity | ||
outputEsm: true | ||
|
||
sdk: | ||
generators: | ||
- name: fernapi/fern-typescript-node-sdk | ||
version: 0.12.8-rc0 | ||
output: | ||
location: npm | ||
url: npm.buildwithfern.com | ||
package-name: "@fern-fern/generator-cli-sdk" | ||
config: | ||
includeUtilsOnUnionMembers: true | ||
useBrandedStringAliases: true | ||
|
||
- name: fernapi/fern-go-sdk | ||
version: 0.22.0 | ||
github: | ||
repository: fern-api/generator-cli-go | ||
config: | ||
union: v1 | ||
packageName: generatorcli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// This file was auto-generated by Fern from our API Definition. | ||
|
||
package client | ||
|
||
import ( | ||
core "github.com/fern-api/generator-cli-go/core" | ||
option "github.com/fern-api/generator-cli-go/option" | ||
http "net/http" | ||
) | ||
|
||
type Client struct { | ||
baseURL string | ||
caller *core.Caller | ||
header http.Header | ||
} | ||
|
||
func NewClient(opts ...option.RequestOption) *Client { | ||
options := core.NewRequestOptions(opts...) | ||
return &Client{ | ||
baseURL: options.BaseURL, | ||
caller: core.NewCaller( | ||
&core.CallerParams{ | ||
Client: options.HTTPClient, | ||
MaxAttempts: options.MaxAttempts, | ||
}, | ||
), | ||
header: options.ToHeader(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// This file was auto-generated by Fern from our API Definition. | ||
|
||
package client | ||
|
||
import ( | ||
option "github.com/fern-api/generator-cli-go/option" | ||
assert "github.com/stretchr/testify/assert" | ||
http "net/http" | ||
testing "testing" | ||
time "time" | ||
) | ||
|
||
func TestNewClient(t *testing.T) { | ||
t.Run("default", func(t *testing.T) { | ||
c := NewClient() | ||
assert.Empty(t, c.baseURL) | ||
}) | ||
|
||
t.Run("base url", func(t *testing.T) { | ||
c := NewClient( | ||
option.WithBaseURL("test.co"), | ||
) | ||
assert.Equal(t, "test.co", c.baseURL) | ||
}) | ||
|
||
t.Run("http client", func(t *testing.T) { | ||
httpClient := &http.Client{ | ||
Timeout: 5 * time.Second, | ||
} | ||
c := NewClient( | ||
option.WithHTTPClient(httpClient), | ||
) | ||
assert.Empty(t, c.baseURL) | ||
}) | ||
|
||
t.Run("http header", func(t *testing.T) { | ||
header := make(http.Header) | ||
header.Set("X-API-Tenancy", "test") | ||
c := NewClient( | ||
option.WithHTTPHeader(header), | ||
) | ||
assert.Empty(t, c.baseURL) | ||
assert.Equal(t, "test", c.header.Get("X-API-Tenancy")) | ||
}) | ||
} |
Oops, something went wrong.