-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/fern-api/fern into niels/xm…
…l-encode-csharp-comments
- Loading branch information
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.
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
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
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
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,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! | ||
|
||
|
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
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,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. | ||
|
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
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
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
54 changes: 54 additions & 0 deletions
54
generators/php/codegen/src/asIs/Json/DateArrayTest.Template.php
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,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.'); | ||
} | ||
} |
55 changes: 0 additions & 55 deletions
55
generators/php/codegen/src/asIs/Json/DateArrayTypeTest.Template.php
This file was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
generators/php/codegen/src/asIs/Json/EmptyArrayTest.Template.php
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,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.'); | ||
} | ||
} |
Oops, something went wrong.