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

Issue #168: OpenAPI documentation #306

Merged
merged 6 commits into from
Jul 23, 2024
Merged

Issue #168: OpenAPI documentation #306

merged 6 commits into from
Jul 23, 2024

Conversation

alexmerlin
Copy link
Member

Note

  • calling $this->created(); from all entities because Psalm complained about $this->created not being initialized from anywhere
  • role(s) must be set when super/admin creates a user (instead of assigning default user role as before) - when users register their account, default role user is automatically assigned, as before
  • prevented MySQL error thrown on getCollection routes if sortBy field's value does not exist as a column in the database

Usage

Default:

vendor/bin/openapi src

Specify output file path:

vendor/bin/openapi src -o public/openapi.yaml

Specify OpenAPI version (default is 3.0.0):

vendor/bin/openapi src -o public/openapi.yaml --version 3.1.0

Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
@alexmerlin alexmerlin self-assigned this Jul 11, 2024
Copy link

github-actions bot commented Jul 11, 2024

Qodana for PHP

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Detected 111 dependencies

Third-party software list

This page lists the third-party software dependencies used in project

Dependency Version Licenses
brick/math 0.12.1 MIT
brick/varexporter 0.4.0 MIT
defuse/php-encryption v2.4.0 MIT
doctrine/collections 2.2.2 MIT
doctrine/common 3.4.4 MIT
doctrine/data-fixtures 1.7.0 MIT
doctrine/dbal 4.0.4 MIT
doctrine/deprecations 1.1.3 MIT
doctrine/event-manager 2.0.1 MIT
doctrine/inflector 2.0.10 MIT
doctrine/instantiator 2.0.0 MIT
doctrine/lexer 3.0.1 MIT
doctrine/migrations 3.8.0 MIT
doctrine/orm 3.2.1 MIT
doctrine/persistence 3.3.3 MIT
dotkernel/dot-cache 4.1.0 MIT
dotkernel/dot-cli 3.6.1 MIT
dotkernel/dot-data-fixtures 1.2.3 MIT
dotkernel/dot-dependency-injection 1.0.0 MIT
dotkernel/dot-errorhandler 3.4.1 MIT
dotkernel/dot-event 3.4.2 MIT
dotkernel/dot-log 3.5.3 MIT
dotkernel/dot-mail 4.2.2 MIT
dotkernel/dot-response-header 3.3.1 MIT
fig/http-message-util 1.1.5 MIT
laminas/laminas-cli 1.10.0 BSD-3-Clause
laminas/laminas-component-installer 3.4.0 BSD-3-Clause
laminas/laminas-config-aggregator 1.15.0 BSD-3-Clause
laminas/laminas-config 3.9.0 BSD-3-Clause
laminas/laminas-diactoros 3.3.1 BSD-3-Clause
laminas/laminas-escaper 2.13.0 BSD-3-Clause
laminas/laminas-eventmanager 3.13.1 BSD-3-Clause
laminas/laminas-filter 2.36.0 BSD-3-Clause
laminas/laminas-http 2.19.0 BSD-3-Clause
laminas/laminas-httphandlerrunner 2.10.0 BSD-3-Clause
laminas/laminas-hydrator 4.15.0 BSD-3-Clause
laminas/laminas-inputfilter 2.30.1 BSD-3-Clause
laminas/laminas-loader 2.10.0 BSD-3-Clause
laminas/laminas-log 2.17.0 BSD-3-Clause
laminas/laminas-mail 2.25.1 BSD-3-Clause
laminas/laminas-mime 2.12.0 BSD-3-Clause
laminas/laminas-paginator 2.18.1 BSD-3-Clause
laminas/laminas-permissions-acl 2.16.0 BSD-3-Clause
laminas/laminas-permissions-rbac 3.6.0 BSD-3-Clause
laminas/laminas-servicemanager 3.22.1 BSD-3-Clause
laminas/laminas-stdlib 3.19.0 BSD-3-Clause
laminas/laminas-stratigility 3.12.0 BSD-3-Clause
laminas/laminas-text 2.11.0 BSD-3-Clause
laminas/laminas-uri 2.11.0 BSD-3-Clause
laminas/laminas-validator 2.62.0 BSD-3-Clause
lcobucci/clock 3.2.0 MIT
lcobucci/jwt 5.3.0 BSD-3-Clause
league/event 2.2.0 MIT
league/oauth2-server 8.5.4 MIT
league/uri-interfaces 7.4.1 MIT
league/uri 7.4.1 MIT
mezzio/mezzio-authentication-oauth2 2.8.0 BSD-3-Clause
mezzio/mezzio-authentication 1.9.0 BSD-3-Clause
mezzio/mezzio-authorization-acl 1.10.0 BSD-3-Clause
mezzio/mezzio-authorization-rbac 1.7.0 BSD-3-Clause
mezzio/mezzio-authorization 1.9.0 BSD-3-Clause
mezzio/mezzio-cors 1.12.1 BSD-3-Clause
mezzio/mezzio-fastroute 3.11.0 BSD-3-Clause
mezzio/mezzio-hal 2.9.0 BSD-3-Clause
mezzio/mezzio-helpers 5.16.0 BSD-3-Clause
mezzio/mezzio-problem-details 1.14.0 BSD-3-Clause
mezzio/mezzio-router 3.17.0 BSD-3-Clause
mezzio/mezzio-template 2.10.0 BSD-3-Clause
mezzio/mezzio-twigrenderer 2.15.0 BSD-3-Clause
mezzio/mezzio 3.19.1 BSD-3-Clause
nikic/fast-route v1.3.0 BSD-3-Clause
nikic/php-parser v4.19.1 BSD-3-Clause
paragonie/random_compat v9.99.100 MIT
psr/cache 3.0.0 MIT
psr/clock 1.0.0 MIT
psr/container 1.1.2 MIT
psr/event-dispatcher 1.0.0 MIT
psr/http-client 1.0.3 MIT
psr/http-factory 1.1.0 MIT
psr/http-message 1.1 MIT
psr/http-server-handler 1.0.2 MIT
psr/http-server-middleware 1.0.2 MIT
psr/link 1.1.1 MIT
psr/log 1.1.4 MIT
ramsey/collection 2.0.0 MIT
ramsey/uuid-doctrine 2.1.0 MIT
ramsey/uuid 4.7.6 MIT
roave/psr-container-doctrine 5.2.2 BSD-2-Clause
spatie/array-to-xml 3.3.0 MIT
symfony/cache-contracts v3.5.0 MIT
symfony/cache v7.1.2 MIT
symfony/console v7.1.2 MIT
symfony/deprecation-contracts v3.5.0 MIT
symfony/event-dispatcher-contracts v3.5.0 MIT
symfony/event-dispatcher v7.1.1 MIT
symfony/filesystem v7.1.2 MIT
symfony/polyfill-ctype v1.30.0 MIT
symfony/polyfill-intl-grapheme v1.30.0 MIT
symfony/polyfill-intl-idn v1.30.0 MIT
symfony/polyfill-intl-normalizer v1.30.0 MIT
symfony/polyfill-mbstring v1.30.0 MIT
symfony/polyfill-php72 v1.30.0 MIT
symfony/polyfill-php80 v1.30.0 MIT
symfony/service-contracts v3.5.0 MIT
symfony/stopwatch v7.1.1 MIT
symfony/string v7.1.2 MIT
symfony/var-exporter v7.1.2 MIT
twig/twig v3.10.3 BSD-3-Clause
webimpress/safe-writer 2.2.0 BSD-2-Clause
webmozart/assert 1.11.0 MIT
willdurand/negotiation 3.1.0 MIT
Contact Qodana team

Contact us at qodana-support@jetbrains.com

@alexmerlin alexmerlin linked an issue Jul 11, 2024 that may be closed by this pull request
@pinclau
Copy link
Member

pinclau commented Jul 11, 2024

@alexmerlin From me, just a little sugestion.

The UI for this is just a small step, you could make the file to be generated in public/docs/openapi.yaml and with this an additional index.html to be installed or already be presend there

the content of index.html would be this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="description" content="Dotkernel Documentation" />
    <title>Dotkernel API DOCS</title>
    <link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui-bundle.js" crossorigin></script>
<script>
    window.onload = () => {
        window.ui = SwaggerUIBundle({
            url: 'openapi.yaml',
            dom_id: '#swagger-ui',
        });
    };
</script>
</body>
</html>

You can leave the assets to be served from cdn or import them to be served from the docs folder

Signed-off-by: Alex Karajos <alex.merlin.1985@gmail.com>
composer.json Outdated Show resolved Hide resolved
Signed-off-by: arhimede <julian@dotkernel.com>
@arhimede arhimede merged commit 8038038 into 5.0 Jul 23, 2024
22 checks passed
@alexmerlin alexmerlin deleted the issue-168 branch July 23, 2024 11:31
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.

CLI-based code generators working from OpenAPI specs
3 participants