Skip to content
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

Refactor example code to avoid text on stdout #1208

Merged
merged 1 commit into from
Apr 17, 2022
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
2 changes: 1 addition & 1 deletion Examples/polymorphism/polymorphism-3.1.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ components:
type: string
type:
type: string
const: 'Virtual'
const: Virtual
FlResponsible:
allOf:
-
Expand Down
35 changes: 15 additions & 20 deletions Examples/using-refs/OpenApiSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ class OpenApiSpec
{
}

?>
You can define top-level parameters which can be references with $ref="#/components/parameters/$parameter"
<?php

/**
* You can define top-level parameters which can be references with $ref="#/components/parameters/parameter".
*
* @OA\Parameter(
* parameter="product_id_in_path_required",
* name="product_id",
Expand Down Expand Up @@ -45,16 +43,16 @@ class ProductRequestBody
{
}

?>
You can define top-level responses which can be references with $ref="#/components/responses/$response"

I find it usefull to add @OA\Response(ref="#/components/responses/todo") to the operations when i'm starting out with writting the swagger documentation.
As it bypasses the "@OA\Get() requires at least one @OA\Response()" error and you'll get a nice list of the available api calls in swagger-ui.

Then later, a search for '#/components/responses/todo' will reveal the operations I haven't documented yet.
<?php

/**
* You can define top-level responses which can be references with $ref="#/components/responses/response".
*
* I find it useful to add `@OA\Response(ref="#/components/responses/todo")` to the operations when i'm starting out with
* writing the swagger documentation.
* As it bypasses the `@OA\Get()` it requires at least one `@OA\Response()` error and you'll get
* a nice list of the available api calls in swagger-ui.
*
* Then later, a search for '#/components/responses/todo' will reveal the operations I haven't documented yet.
*
* @OA\Response(
* response="product",
* description="All information about a product",
Expand All @@ -75,14 +73,11 @@ class TodoResponse
{
}

?>

And although definitions are generally used for model-level schema's' they can be used for smaller things as well.
Like a @OA\Schema, @OA\Property or @OA\Items that is uses multiple times.

<?php

/**
* And although definitions are generally used for model-level schema's' they can be used for smaller things as well.
*
* Like a `@OA\Schema`, `@OA\Property` or `@OA\Items` that is uses multiple times.
*
* @OA\Schema(
* schema="product_status",
* type="string",
Expand Down