Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
armandobelardo committed Oct 3, 2024
2 parents c2eaa4a + e46a4f7 commit 66f1a37
Show file tree
Hide file tree
Showing 7,612 changed files with 272,977 additions and 231,886 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ generated
bundle.c?js
.pnp*
packages/ir-sdk/**
packages/cli/api-importers/conjure/conjure-sdk/**
packages/docs-config/**
packages/cli/openapi-ir-sdk/**
packages/cli/configuration/src/docs-yml/schemas/**
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/validate-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ jobs:
generator-validate:
strategy:
matrix:
generator:
[
generator: [
fastapi,
pydantic,
python-sdk,
Expand All @@ -46,6 +45,8 @@ jobs:
ts-express,
csharp-sdk,
csharp-model
php-sdk,
php-model
]

runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/write-changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ on:
- "generators/python/sdk/versions.yml"
- "generators/ruby/model/versions.yml"
- "generators/ruby/sdk/versions.yml"
- "generators/php/sdk/versions.yml"
- "generators/php/model/versions.yml"
- "generators/typescript/express/versions.yml"
# This file
- ".github/workflows/write-changelogs.yml"
Expand Down
2 changes: 2 additions & 0 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ navigation:
contents:
- page: Generate your First SDK
path: ./pages/sdks/getting-started/generate-your-first-sdk.mdx
- page: Preview your SDK Locally
path: ./pages/sdks/getting-started/preview-your-sdk-locally.mdx
- page: Publish a Public-Facing SDK
path: ./pages/sdks/publish-sdk/publish-your-sdk.mdx
hidden: true
Expand Down
5 changes: 5 additions & 0 deletions fern/pages/changelogs/cli/2024-09-30.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 0.43.8
**`(fix):`** Any markdown files that have custom components are also pushed up to the Fern Docs
platform.


7 changes: 7 additions & 0 deletions fern/pages/changelogs/cli/2024-10-02.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## 0.44.0-rc0
**`(feat):`** The Fern CLI now supports parsing [Conjure](https://github.com/palantir/conjure), Palantir's
home-grown API Definition format.

If you know a company that is using Conjure that wants API Docs + SDKs, send them our way!


3 changes: 3 additions & 0 deletions fern/pages/changelogs/go-sdk/2024-09-29.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.27.0
**`(feat):`** Add support for SSE (Server-Sent Events) streaming responses. The user-facing interface for streaming responses remains the same between standard HTTP streaming and SSE.

2 changes: 1 addition & 1 deletion fern/pages/changelogs/php-sdk/2024-09-25.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## 0.1.2
**`(feat):`** Represent enums in objects as strings.

**`(fix):`** Generated wrapped requests now implement `SerializableType`.
**`(fix):`** Generated wrapped requests now implement `JsonSerializableType`.

**`(fix):`** Fix a bug where we don't set the request options baseurl properly.

Expand Down
9 changes: 9 additions & 0 deletions fern/pages/changelogs/php-sdk/2024-10-03.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## 0.1.3
**`(feat):`** Support inheritance for types and inlined requests.

**`(feat):`** Support undiscriminated unions.

**`(fix):`** Fix ci.yml `php-version` field name.

**`(feat):`** We now allow an empty constructor on types with no required properties.

73 changes: 73 additions & 0 deletions fern/pages/sdks/getting-started/preview-your-sdk-locally.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: Preview your SDK
subtitle: Use Fern's CLI tool to preview your SDK locally.
---

[Once you configure your SDK](/learn/sdks/getting-started/generate-your-first-sdk), you can preview the generated SDK code using Fern's CLI.

Simply append the `--preview` flag to the command used to generate the SDK and you will see the generated code populated in a `.preview` folder within your `fern` folder.

<Tip title="Custom Code">
[If you have added custom code to your SDK](/learn/sdks/features/augment-with-custom-code), `--preview` will preserve those changes.
</Tip>

Here's an example of how you can preview your SDK:

<Steps>
### Generator configuration
```yaml generators.yml
api:
path: ./path/to/openapi.yml
groups:
python-sdk:
generators:
- name: fernapi/fern-python-sdk
version: 3.0.0
output:
location: pypi
package-name: imdb
token: ${PYPI_TOKEN}
github:
repository: imdb/imdb-python
config:
client_class_name: imdb
```
### Invoke the Fern CLI
```shell
fern generate --group python-sdk --preview
```

### Preview your SDK

The resulting folder structure will look like this:

<Tabs>
<Tab title="OpenAPI">
```shell {3-5}
fern/
├─ fern.config.json
├─ .preview/
└─ fern-python-sdk/
└─ ...
├─ generators.yml
└─ openapi/
└─ openapi.yml
```
</Tab>
<Tab title="Fern Definition">
```shell {3-5}
fern/
├─ fern.config.json
├─ .preview/
└─ fern-python-sdk/
└─ ...
├─ generators.yml
└─ definition/
├─ api.yml
└─ imdb.yml
```
</Tab>
</Tabs>
</Steps>
7 changes: 4 additions & 3 deletions generators/commons/src/project/File.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AbsoluteFilePath, join, RelativeFilePath } from "@fern-api/fs-utils";
import { mkdir, writeFile } from "fs/promises";
import path from "path";

export class File {
public filename: string;
Expand All @@ -13,8 +14,8 @@ export class File {
}

public async write(directoryPrefix: AbsoluteFilePath): Promise<void> {
const outputDirectory = join(directoryPrefix, this.directory);
await mkdir(outputDirectory, { recursive: true });
await writeFile(`${outputDirectory}/${this.filename}`, this.fileContents);
const filepath = `${join(directoryPrefix, this.directory)}/${this.filename}`;
await mkdir(path.dirname(filepath), { recursive: true });
await writeFile(filepath, this.fileContents);
}
}
67 changes: 38 additions & 29 deletions generators/php/codegen/src/AsIs.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,43 @@
export enum AsIsFiles {
BaseApiRequest = "BaseApiRequest.Template.php",
ClientOptions = "ClientOptions.Template.php",
GitIgnore = ".gitignore",
// Top-level files.
GithubCiYml = "github-ci.yml",
HttpMethod = "HttpMethod.Template.php",
JsonApiRequest = "JsonApiRequest.Template.php",
GitIgnore = ".gitignore",
PhpStanNeon = "phpstan.neon",
PhpUnitXml = "phpunit.xml",
RawClient = "RawClient.Template.php",
RawClientTest = "RawClientTest.Template.php",
DateArrayTypeTest = "DateArrayTypeTest.Template.php",
EmptyArraysTest = "EmptyArraysTest.Template.php",
InvalidTypesTest = "InvalidTypesTest.Template.php",
MixedDateArrayTypeTest = "MixedDateArrayTypeTest.Template.php",
NestedUnionArrayTypeTest = "NestedUnionArrayTypeTest.Template.php",
NullableArrayTypeTest = "NullableArrayTypeTest.Template.php",
NullPropertyTypeTest = "NullPropertyTypeTest.Template.php",
ScalarTypesTest = "ScalarTypesTest.Template.php",
EnumTest = "EnumTest.Template.php",
TestTypeTest = "TestTypeTest.Template.php",
UnionArrayTypeTest = "UnionArrayTypeTest.Template.php",
ArrayType = "ArrayType.Template.php",
Constant = "Constant.Template.php",
DateType = "DateType.Template.php",
JsonProperty = "JsonProperty.Template.php",
SerializableType = "SerializableType.Template.php",
Union = "Union.Template.php",
JsonDecoder = "JsonDecoder.Template.php",
JsonDeserializer = "JsonDeserializer.Template.php",
JsonEncoder = "JsonEncoder.Template.php",
JsonSerializer = "JsonSerializer.Template.php",
Utils = "Utils.Template.php"

// Core/Client files.
BaseApiRequest = "Client/BaseApiRequest.Template.php",
HttpMethod = "Client/HttpMethod.Template.php",
RawClient = "Client/RawClient.Template.php",
RawClientTest = "Client/RawClientTest.Template.php",

// Core/Json files.
JsonApiRequest = "Json/JsonApiRequest.Template.php",
JsonDecoder = "Json/JsonDecoder.Template.php",
JsonDeserializer = "Json/JsonDeserializer.Template.php",
JsonEncoder = "Json/JsonEncoder.Template.php",
JsonProperty = "Json/JsonProperty.Template.php",
JsonSerializer = "Json/JsonSerializer.Template.php",
JsonSerializableType = "Json/JsonSerializableType.Template.php",
Utils = "Json/Utils.Template.php",

// Tests/Core/Json files.
DateArrayTest = "Json/DateArrayTest.Template.php",
EmptyArrayTest = "Json/EmptyArrayTest.Template.php",
EnumTest = "Json/EnumTest.Template.php",
ExhaustiveTest = "Json/ExhaustiveTest.Template.php",
InvalidTest = "Json/InvalidTest.Template.php",
NestedUnionArrayTest = "Json/NestedUnionArrayTest.Template.php",
NullableArrayTest = "Json/NullableArrayTest.Template.php",
NullPropertyTest = "Json/NullPropertyTest.Template.php",
ScalarTypesTest = "Json/ScalarTest.Template.php",
TraitTest = "Json/TraitTest.Template.php",
UnionArrayTest = "Json/UnionArrayTest.Template.php",
UnionPropertyTest = "Json/UnionPropertyTest.Template.php",

// Core/Types files.
ArrayType = "Types/ArrayType.Template.php",
Constant = "Types/Constant.Template.php",
Date = "Types/Date.Template.php",
Union = "Types/Union.Template.php"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Psr\Http\Client\ClientExceptionInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use <%= coreNamespace%>\Json\JsonApiRequest;

class RawClient
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\RequestInterface;
use <%= coreNamespace%>\BaseApiRequest;
use <%= coreNamespace%>\JsonApiRequest;
use <%= coreNamespace%>\HttpMethod;
use <%= coreNamespace%>\RawClient;
use <%= coreNamespace%>\Client\BaseApiRequest;
use <%= coreNamespace%>\Client\HttpMethod;
use <%= coreNamespace%>\Client\RawClient;
use <%= coreNamespace%>\Json\JsonApiRequest;


class RawClientTest extends TestCase
Expand Down
55 changes: 0 additions & 55 deletions generators/php/codegen/src/asIs/DateArrayTypeTest.Template.php

This file was deleted.

16 changes: 0 additions & 16 deletions generators/php/codegen/src/asIs/DateType.Template.php

This file was deleted.

Loading

0 comments on commit 66f1a37

Please sign in to comment.