forked from cebe/yii2-openapi
-
Notifications
You must be signed in to change notification settings - Fork 1
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
DbModel with openapiSchema #28
Merged
Merged
Conversation
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
5169b8e
to
f546b4c
Compare
b5ddc82
to
36d3a0e
Compare
cebe
requested changes
Sep 10, 2024
ec51111
to
e788a21
Compare
32acea6
to
fd024be
Compare
d96095b
to
36c4107
Compare
36c4107
to
9497bf4
Compare
cebe
approved these changes
Sep 13, 2024
Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
openapiSchema
to theDbModel
. This allows passing arbitraryx-*
metadata to theDbModel
.x-scenarios
attribute includesname
anddescription
. It generates constants for scenarios. The advantage is that when using thisschema.yaml
for the frontend with a ClientGenerator, the scenarios will be identical in both models, frontend and backend.The
DbModel
has received a new attribute calledscenarioDefaultDescription
.Example:
project.yaml
project.php
...
AcceptedInputs: {scenarioName}, {scenarioConst}, {modelName}
config.php
project.php
A warning is now displayed at the top of the Model class:
This file is generated by Gii, do not change manually!
The Model class description now has a fallback if no description is provided. Fallback:
This is the model class for table <tableName>.
The "bug with spaces" in the Model class description has been fixed, so that code style no longer complains. The description is now formatted using
cebe\yii2openapi\lib\helpers\FormatHelper::getFormattedDescription
.cebe\yii2openapi\lib\items\Attribute::getFormattedDescription
has been renamed tocebe\yii2openapi\lib\items\Attribute::getPropertyAnnotation
.There are two reasons for this:
phpType
+columnName
+description
(from the description field in model.yaml). It is not ideal to label this as "description" since it can cause confusion.@property
tag to indicate that the model class has properties likeid
,name
, etc. Such annotations are meant to inform tools like IDEs (e.g., PhpStorm) or documentation generators about the properties of the class, especially when these properties are not directly visible in the code (e.g., through magic methods like__get()
and__set()
).The "bug with spaces" in the property annotation has also been fixed, so that code style no longer complains. The description is formatted using
cebe\yii2openapi\lib\helpers\FormatHelper::getFormattedDescription
.