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

Update usage documentation, delete unused code #3

Open
wants to merge 3 commits into
base: feature/standalone
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions lib/graphiti/open_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module Graphiti
module OpenApi
class Error < StandardError
end
end
end

Expand Down
5 changes: 0 additions & 5 deletions lib/graphiti/open_api/engine.rb
Original file line number Diff line number Diff line change
@@ -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
7 changes: 0 additions & 7 deletions lib/templates/installer.rb
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -15,6 +11,3 @@
public/api/v1/openapi.yaml
IGNORE
end

say "Installing JavaScript dependencies"
run "yarn add swagger-ui"