-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat]: update openapi version #134
Conversation
$definitions = (!empty($this->data['components']['schemas'])) ? $this->data['components']['schemas'] : []; | ||
|
||
$properties = Arr::get($definitions, $definition, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$definitions = (!empty($this->data['components']['schemas'])) ? $this->data['components']['schemas'] : []; | |
$properties = Arr::get($definitions, $definition, []); | |
$properties = Arr::get($this->data, "components.schemas.{$definition}", []); |
$this->item['parameters'][] = [ | ||
'in' => 'body', | ||
'name' => 'body', | ||
$type = $this->request->header('Content-Type') ?? 'application/json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$type = $this->request->header('Content-Type') ?? 'application/json'; | |
$type = $this->request->header('Content-Type', 'application/json'); |
'content' => [ | ||
$type => [ | ||
'schema' => [ | ||
"\$ref" => "#/components/schemas/{$actionName}Object", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"\$ref" => "#/components/schemas/{$actionName}Object", | |
'$ref' => "#/components/schemas/{$actionName}Object", |
@@ -559,7 +577,7 @@ protected function saveDefinitions($objectName, $rules, $attributes, array $anno | |||
} | |||
|
|||
$data['example'] = $this->generateExample($data['properties']); | |||
$this->data['definitions'][$objectName . 'Object'] = $data; | |||
$this->data['components']['schemas'][$objectName . 'Object'] = $data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->data['components']['schemas'][$objectName . 'Object'] = $data; | |
$this->data['components']['schemas']["{$objectName}Object"] = $data; |
if (isset($this->data['components']['schemas'][$actionName . 'Object']['properties'])) { | ||
$objectParametersCount = count($this->data['components']['schemas'][$actionName . 'Object']['properties']); | ||
} else { | ||
$objectParametersCount = 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (isset($this->data['components']['schemas'][$actionName . 'Object']['properties'])) { | |
$objectParametersCount = count($this->data['components']['schemas'][$actionName . 'Object']['properties']); | |
} else { | |
$objectParametersCount = 0; | |
} | |
$properties = Arr::get($this->data, "components.schemas.{$actionName}Object.properties", []); | |
$objectParametersCount = count($properties); |
if (empty($documentation['components']['schemas'][$definition])) { | ||
$documentation['components']['schemas'][$definition] = $additionalDocumentation['components']['schemas'][$definition]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (empty($documentation['components']['schemas'][$definition])) { | |
$documentation['components']['schemas'][$definition] = $additionalDocumentation['components']['schemas'][$definition]; | |
Arr::add($documentation, "components.schemas.{$definition}, $additionalDocumentation['components']['schemas'][$definition]); |
{ | ||
$allowedContentType = false; | ||
|
||
$types = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move it to the class const
|
||
if (!$allowedContentType) { | ||
throw new InvalidSwaggerSpecException( | ||
"Operation '{$operationId}' has body parameters. Only one or the other is allowed." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Operation '{$operationId}' has body parameters. Only one or the other is allowed." | |
"Operation '{$operationId}' has invalid content types: {$actualTypes}." |
Quality Gate passedIssues Measures |
@aizlee please make refactoring accordingly my comments as a separate PR |
Description
Update OpenAPI version to 3.1.0