Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/fern-api/fern into niels/xm…
Browse files Browse the repository at this point in the history
…l-encode-csharp-comments
  • Loading branch information
Swimburger committed Oct 4, 2024
2 parents 8f8e20c + 1c15dde commit 61d58c6
Show file tree
Hide file tree
Showing 4,719 changed files with 151,386 additions and 144,127 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
18 changes: 17 additions & 1 deletion .github/workflows/validate-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,23 @@ jobs:
generator-validate:
strategy:
matrix:
generator: [fastapi, pydantic, python-sdk, go-sdk, ruby-sdk, postman, openapi, java-sdk, java-model, java-spring, ts-express]
generator: [
fastapi,
pydantic,
python-sdk,
go-sdk,
ruby-sdk,
postman,
openapi,
java-sdk,
java-model,
java-spring,
ts-express,
csharp-sdk,
csharp-model
php-sdk,
php-model
]

runs-on: ubuntu-latest
steps:
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
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!


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.

32 changes: 31 additions & 1 deletion fern/pages/docs/components/callouts.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
---
title: 'Callouts'
description: 'A built-in component to show important information to the reader'
subtitle: 'A built-in component to show important information to the reader'
icon: 'circle-exclamation'
---

## Callout properties

Customize your Callouts using the `title` and `icon` properties.

<ParamField path="title" type="string" required={false}>
The title of your Callout
</ParamField>
<ParamField path="icon" type="string | element" required={false}>
The icon of your Callout. Can be a [Font Awesome](https://fontawesome.com/icons) icon name or an HTML element.
</ParamField>

<br />

<Tabs>
<Tab title="Callout">
<Tip title="Example Callout" icon="leaf">
This Callout uses a title and a custom icon.
</Tip>
</Tab>
<Tab title="Markdown">
```markdown
<Tip title="Example Callout" icon="leaf">
This Callout uses a title and a custom icon.
</Tip>
```
</Tab>
</Tabs>

## Callout varieties

### Note callouts

<Note>This adds a note in the content</Note>
Expand Down
4 changes: 2 additions & 2 deletions fern/pages/docs/getting-started/global-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ navbar-links:
Text inside the button.
</ParamField>

<ParamField path="rounded" type="boolean" required={false}>
Whether the button is rounded or square.
<ParamField path="rounded" type="boolean" required={false} default="false">
When `true`, the border radius of the button will be fully rounded.
</ParamField>

<ParamField path="icon" type="string" required={false}>
Expand Down
26 changes: 13 additions & 13 deletions generators/php/codegen/src/AsIs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@ export enum AsIsFiles {
JsonEncoder = "Json/JsonEncoder.Template.php",
JsonProperty = "Json/JsonProperty.Template.php",
JsonSerializer = "Json/JsonSerializer.Template.php",
SerializableType = "Json/SerializableType.Template.php",
JsonSerializableType = "Json/JsonSerializableType.Template.php",
Utils = "Json/Utils.Template.php",

// Tests/Core/Json files.
DateArrayTypeTest = "Json/DateArrayTypeTest.Template.php",
EmptyArraysTest = "Json/EmptyArraysTest.Template.php",
DateArrayTest = "Json/DateArrayTest.Template.php",
EmptyArrayTest = "Json/EmptyArrayTest.Template.php",
EnumTest = "Json/EnumTest.Template.php",
InvalidTypesTest = "Json/InvalidTypesTest.Template.php",
MixedDateArrayTypeTest = "Json/MixedDateArrayTypeTest.Template.php",
NestedUnionArrayTypeTest = "Json/NestedUnionArrayTypeTest.Template.php",
NullableArrayTypeTest = "Json/NullableArrayTypeTest.Template.php",
NullPropertyTypeTest = "Json/NullPropertyTypeTest.Template.php",
ScalarTypesTest = "Json/ScalarTypesTest.Template.php",
TestTypeTest = "Json/TestTypeTest.Template.php",
UnionArrayTypeTest = "Json/UnionArrayTypeTest.Template.php",
UnionPropertyTypeTest = "Json/UnionPropertyTypeTest.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",
DateType = "Types/DateType.Template.php",
Date = "Types/Date.Template.php",
Union = "Types/Union.Template.php"
}
54 changes: 54 additions & 0 deletions generators/php/codegen/src/asIs/Json/DateArrayTest.Template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace <%= namespace%>;

use DateTime;
use PHPUnit\Framework\TestCase;
use <%= coreNamespace%>\Json\JsonProperty;
use <%= coreNamespace%>\Json\JsonSerializableType;
use <%= coreNamespace%>\Types\ArrayType;

class DateArray extends JsonSerializableType
{
/**
* @var string[] $dates
*/
#[ArrayType(['date'])]
#[JsonProperty('dates')]
public array $dates;

/**
* @param array{
* dates: string[],
* } $values
*/
public function __construct(
array $values,
) {
$this->dates = $values['dates'];
}
}

class DateArrayTest extends TestCase
{
public function testDateTimeInArrays(): void
{
$expectedJson = json_encode(
[
'dates' => ['2023-01-01', '2023-02-01', '2023-03-01']
],
JSON_THROW_ON_ERROR
);

$object = DateArray::fromJson($expectedJson);
$this->assertInstanceOf(DateTime::class, $object->dates[0], 'dates[0] should be a DateTime instance.');
$this->assertEquals('2023-01-01', $object->dates[0]->format('Y-m-d'), 'dates[0] should have the correct date.');
$this->assertInstanceOf(DateTime::class, $object->dates[1], 'dates[1] should be a DateTime instance.');
$this->assertEquals('2023-02-01', $object->dates[1]->format('Y-m-d'), 'dates[1] should have the correct date.');
$this->assertInstanceOf(DateTime::class, $object->dates[2], 'dates[2] should be a DateTime instance.');
$this->assertEquals('2023-03-01', $object->dates[2]->format('Y-m-d'), 'dates[2] should have the correct date.');

$actualJson = $object->toJson();
$this->assertJsonStringEqualsJsonString($expectedJson, $actualJson, 'Serialized JSON does not match original JSON for dates array.');
}
}

This file was deleted.

71 changes: 71 additions & 0 deletions generators/php/codegen/src/asIs/Json/EmptyArrayTest.Template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

namespace <%= namespace%>;

use PHPUnit\Framework\TestCase;
use <%= coreNamespace%>\Json\JsonProperty;
use <%= coreNamespace%>\Json\JsonSerializableType;
use <%= coreNamespace%>\Types\ArrayType;
use <%= coreNamespace%>\Types\Union;

class EmptyArray extends JsonSerializableType
{
/**
* @var string[] $emptyStringArray
*/
#[ArrayType(['string'])]
#[JsonProperty('empty_string_array')]
public array $emptyStringArray;

/**
* @var array<string, string|null> $emptyMapArray
*/
#[JsonProperty('empty_map_array')]
#[ArrayType(['integer' => new Union('string', 'null')])]
public array $emptyMapArray;

/**
* @var array<string|null> $emptyDatesArray
*/
#[ArrayType([new Union('date', 'null')])]
#[JsonProperty('empty_dates_array')]
public array $emptyDatesArray;

/**
* @param array{
* emptyStringArray: string[],
* emptyMapArray: array<string, string|null>,
* emptyDatesArray: array<string|null>,
* } $values
*/
public function __construct(
array $values,
) {
$this->emptyStringArray = $values['emptyStringArray'];
$this->emptyMapArray = $values['emptyMapArray'];
$this->emptyDatesArray = $values['emptyDatesArray'];
}
}

class EmptyArrayTest extends TestCase
{
public function testEmptyArray(): void
{
$expectedJson = json_encode(
[
'empty_string_array' => [],
'empty_map_array' => [],
'empty_dates_array' => []
],
JSON_THROW_ON_ERROR
);

$object = EmptyArray::fromJson($expectedJson);
$this->assertEmpty($object->emptyStringArray, 'empty_string_array should be empty.');
$this->assertEmpty($object->emptyMapArray, 'empty_map_array should be empty.');
$this->assertEmpty($object->emptyDatesArray, 'empty_dates_array should be empty.');

$actualJson = $object->toJson();
$this->assertJsonStringEqualsJsonString($expectedJson, $actualJson, 'Serialized JSON does not match original JSON for EmptyArraysType.');
}
}
Loading

0 comments on commit 61d58c6

Please sign in to comment.