GithubHelp home page GithubHelp logo

yoan-durand / openapi-spec-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from byte-it/openapi-spec-generator

0.0 0.0 0.0 117 KB

Creates Open API spec for a Laravel JSON:API

PHP 100.00%

openapi-spec-generator's Introduction

OpenAPI v3 Spec Generator

Designed to work with Laravel JSON:API

!!! Disclaimer: this project is work in progress and likely contains many bugs, etc !!!

What it can and can't

Can

  • Generate Schemas/Responses/Request/Errors for all default Laravel JSON:API routes
  • Use a seeded database to generate examples

Can't yet

  • Customisation of the generation
  • Generation for custom actions
  • Generation for custom filters
  • Generation for anything custom
  • Generation for MorphTo relations (MorphToMany works)
  • Generation of Pagination Meta
  • Generation of Includes
  • Generation of Authentication/Authorization

TODO

  • Command to generate to storage folder
  • Get basic test suite running with GitHub Actions
  • Add extra operation descriptions via config
  • Add in tags & x-tagGroups (via config)
  • Add tests (Use the dummy by laraveljsonapi to integrate all features)
  • Add custom actions
  • Split schemas/requests/responses by action
  • Consider field attributes
    • bool readonly
    • bool hidden
    • closure based readonly (create/update)
    • closure based hidden
  • List sortable fields
  • Fix includes and relations
    • Add relationship routes
    • Add includes
  • Add authentication
  • Add custom queries/filters
  • Add a way to document custom actions
  • Tidy up the code!!
  • Replace cebe/php-openapi with goldspecdigital/oooas
  • Move to an architecture inspired by vyuldashev/laravel-openapi
  • Use php8 attributes on actions/classes to generate custom docs

๐Ÿ™ Based upon initial prototype by martianatwork and glennjacobs

Usage

Install package

composer require byteit/openapi-spec-generator

Publish the config file

php artisan vendor:publish --provider="LaravelJsonApi\OpenApiSpec\OpenApiServiceProvider"

Generate the Open API spec

php artisan jsonapi:openapi:generate v1

Note that a seeded DB is required! The seeded data will be used to generate Samples.

Generating Documentation

A quick way to preview your documentation is to use Speccy. Ensure you have installed Speccy globally and then you can use the following command.

speccy serve storage/app/v1_openapi.yaml

openapi-spec-generator's People

Contributors

bbrala avatar captncc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.