Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.11.1] - 2022-11-14

### Fixed
- Handling of `*Of` in PHP generation.

## [1.11.0] - 2022-09-18

### Added
Expand Down Expand Up @@ -218,6 +223,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Local file resolver in references.

[1.11.1]: https://github.com/swaggest/json-cli/compare/v1.10.1...v1.11.1
[1.11.0]: https://github.com/swaggest/json-cli/compare/v1.10.0...v1.11.0
[1.10.0]: https://github.com/swaggest/json-cli/compare/v1.9.1...v1.10.0
[1.9.1]: https://github.com/swaggest/json-cli/compare/v1.9.0...v1.9.1
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"salsify/json-streaming-parser": "^7.0",
"swaggest/json-schema": "^0.12.41",
"swaggest/go-code-builder": "0.4.51",
"swaggest/php-code-builder": "^0.2.37",
"swaggest/php-code-builder": "^0.2.38",
"swaggest/code-builder": "^0.3.5",
"swaggest/json-schema-maker": "^0.3.7"
},
"require-dev": {
"phperf/phpunit": "4.8.37"
"phperf/phpunit": "4.8.38"
},
"autoload": {
"psr-4": {
Expand Down
40 changes: 20 additions & 20 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class App extends Command\Application
{
public static $ver = 'v1.11.0';
public static $ver = 'v1.11.1';

public $diff;
public $apply;
Expand Down
2 changes: 1 addition & 1 deletion src/GenPhp.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static function setUpDefinition(Command\Definition $definition, $options)
->setIsRequired();

$options->rootName = Command\Option::create()->setType()
->setDescription('Go root struct name, default "Structure", only used for # pointer');
->setDescription('Root class name, default "Structure", only used for # pointer');

static::setupBuilderOptions($options);
Base::setupGenOptions($definition, $options);
Expand Down
58 changes: 58 additions & 0 deletions tests/assets/issue39.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"id": "/Test",
"type": "object",
"properties": {
"label": {
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "object",
"properties": {
"test1": {
"type": "string"
}
}
},
{
"type": "object",
"properties": {
"test2": {
"type": "string"
}
}
}
]
},
"label2": {
"oneOf": [
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "object",
"properties": {
"test1": {
"type": "string"
}
}
},
{
"type": "object",
"properties": {
"test2": {
"type": "string"
}
}
}
]
}
}
}
21 changes: 21 additions & 0 deletions tests/assets/issue39_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"id": "/Test",
"anyOf": [
{
"type": "object",
"properties": {
"test1": {
"type": "string"
}
}
},
{
"type": "object",
"properties": {
"test2": {
"type": "integer"
}
}
}
]
}
55 changes: 55 additions & 0 deletions tests/assets/markdown/issue39/entities.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Types

* [`Label2OneOf2`](#label2oneof2)
* [`Label2OneOf3`](#label2oneof3)
* [`LabelAnyOf2`](#labelanyof2)
* [`LabelAnyOf3`](#labelanyof3)
* [`Propertyb14a7b`](#propertyb14a7b)




### <a id="label2oneof2"></a>Label2OneOf2



|Property|Type |
|--------|--------|
|`test1` |`String`|


### <a id="label2oneof3"></a>Label2OneOf3



|Property|Type |
|--------|--------|
|`test2` |`String`|


### <a id="labelanyof2"></a>LabelAnyOf2



|Property|Type |
|--------|--------|
|`test1` |`String`|


### <a id="labelanyof3"></a>LabelAnyOf3



|Property|Type |
|--------|--------|
|`test2` |`String`|


### <a id="propertyb14a7b"></a>Propertyb14a7b



|Property|Type |
|--------|------------------------------------------------------------------------------------|
|`label` |`Number`, `Number`, [`LabelAnyOf2`](#labelanyof2), [`LabelAnyOf3`](#labelanyof3) |
|`label2`|`Number`, `Number`, [`Label2OneOf2`](#label2oneof2), [`Label2OneOf3`](#label2oneof3)|
24 changes: 24 additions & 0 deletions tests/assets/markdown/issue39/entities2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Types

* [`AnyOf0`](#anyof0)
* [`AnyOf1`](#anyof1)




### <a id="anyof0"></a>AnyOf0



|Property|Type |
|--------|--------|
|`test1` |`String`|


### <a id="anyof1"></a>AnyOf1



|Property|Type |
|--------|--------|
|`test2` |`Number`|
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Swaggest\JsonSchema\Structure\ClassStructure;


class Operation extends ClassStructure
class OperationOneOf1 extends ClassStructure
{
const X_PROPERTY_PATTERN = '^x-';

Expand Down
6 changes: 3 additions & 3 deletions tests/assets/php/AsyncAPI/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Stream extends ClassStructure
{
const X_PROPERTY_PATTERN = '^x-';

/** @var StreamFraming */
/** @var StreamFramingOneOf0|StreamFramingOneOf1 */
public $framing;

/** @var Message[]|array */
Expand All @@ -44,8 +44,8 @@ public static function setUpProperties($properties, Schema $ownerSchema)
$x->description = "Any property starting with x- is valid.";
$x->setFromRef('#/definitions/vendorExtension');
$properties->framing->setPatternProperty('^x-', $x);
$properties->framing->oneOf[0] = StreamFraming::schema();
$properties->framing->oneOf[1] = StreamFraming::schema();
$properties->framing->oneOf[0] = StreamFramingOneOf0::schema();
$properties->framing->oneOf[1] = StreamFramingOneOf1::schema();
$properties->framing->title = "Stream Framing Object";
$properties->framing->minProperties = 1;
$properties->read = Schema::arr();
Expand Down
Loading