diff --git a/README.md b/README.md index e0a7555..b7249ff 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,16 @@ Set up environment running bin/rails graphiti:openapi:install ``` -Configure OpenAPI template in `config/openapi.yml` and Graphiti::OpenAPI will pick your resources schema and -translate it to OpenAPI 3.0 JSON and YAML files, providing Swagger UI with live API documentation. - ## Usage Edit template in `config/openapi.yml` to customize your OpenAPI output. This file will be used as base for resulting -document. +document. Generate it by executing + +```bash +bin/rails graphiti:openapi:generate +``` + +Results will be saved in `public/#{ApplicationResource.endpoint_namespace}/openapi.json` and `.../openapi.yaml` ## Development diff --git a/lib/graphiti/open_api.rb b/lib/graphiti/open_api.rb index 829f0d4..c9dc21c 100644 --- a/lib/graphiti/open_api.rb +++ b/lib/graphiti/open_api.rb @@ -2,8 +2,6 @@ module Graphiti module OpenApi - class Error < StandardError - end end end diff --git a/lib/graphiti/open_api/engine.rb b/lib/graphiti/open_api/engine.rb index ff76604..44c7ae8 100644 --- a/lib/graphiti/open_api/engine.rb +++ b/lib/graphiti/open_api/engine.rb @@ -1,15 +1,10 @@ require "rails" -require "responders" require "graphiti" module Graphiti module OpenApi class Engine < ::Rails::Engine isolate_namespace Graphiti::OpenApi - - initializer "graphiti.openapi.init" do - Mime::Type.register "text/yaml", :yaml - end end end end diff --git a/lib/templates/installer.rb b/lib/templates/installer.rb index 1a2fe45..b5186b3 100644 --- a/lib/templates/installer.rb +++ b/lib/templates/installer.rb @@ -1,8 +1,4 @@ root = File.expand_path("../..", __dir__) -packs = File.directory?("app/assets/packs") ? "app/assets/packs" : "app/javascripts/packs" - -say "Copying api.js to #{packs}/" -copy_file "#{root}/app/assets/packs/api.js", "#{packs}/api.js" say "Copying openapi.yml to config/" copy_file "#{root}/config/openapi.yml", "config/openapi.yml" @@ -15,6 +11,3 @@ public/api/v1/openapi.yaml IGNORE end - -say "Installing JavaScript dependencies" -run "yarn add swagger-ui"