-
Notifications
You must be signed in to change notification settings - Fork 0
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
TASK: Configure and render documents by name #1
Conversation
This change adds a the configuration of the available spec documents to the setting and uses the document names as basis for rendering via cli-command and controller. Th cli `./flow .openapi:document __name__` will render the same spec as `openapi/specs/__name__`. Also the setting `schemaTargetFilePath` is removed. The cli will output the spec directly to the shell where it can be sent wherever it is needed.
c553faa
to
9be4455
Compare
9be4455
to
5d5c359
Compare
/** | ||
* @param string $name the name of the api document to render | ||
*/ | ||
public function documentCommand(string $name): void |
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.
I really like the convention of class methods being or containing verbs; In this case I instantly wonder what is about to be documented. So I'd prefer openapi:renderdocument or openapidocument:render
|
||
class OpenApiController extends ActionController | ||
{ | ||
protected $defaultViewObjectName = JsonView::class; |
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.
I think we don't need to declare a view if we return string
#[Flow\Inject] | ||
protected OpenApiDocumentRepository $documentRepository; | ||
|
||
public function documentAction(string $name): string |
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.
same as the command controller. In this case specifically, I'd prefer openapidocument/render, because we already have an OpenApiController
Agree. Will address on the refactoring branch |
This change adds a the configuration of the available spec documents to the setting and uses the document names as basis for rendering via cli-command and controller.
Th cli
./flow .openapi:document __name__
will render the same spec asopenapi/specs/__name__
.Also the setting
schemaTargetFilePath
is removed. The cli will output the spec directly to the shell where it can be sent wherever it is needed.