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

TASK: Configure and render documents by name #1

Closed
wants to merge 2 commits into from

Conversation

mficzel
Copy link
Member

@mficzel mficzel commented Mar 19, 2024

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.

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.
@mficzel mficzel force-pushed the task/configureAndRenderDocumentsByName branch from c553faa to 9be4455 Compare March 19, 2024 14:34
/**
* @param string $name the name of the api document to render
*/
public function documentCommand(string $name): void
Copy link
Member

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;
Copy link
Member

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
Copy link
Member

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

@mficzel
Copy link
Member Author

mficzel commented Mar 21, 2024

Agree. Will address on the refactoring branch

@mficzel mficzel closed this Mar 21, 2024
@mficzel mficzel deleted the task/configureAndRenderDocumentsByName branch March 26, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants