FE updates
parent
ea35a202d8
commit
8fa3eb1213
1
Gemfile
1
Gemfile
|
@ -18,6 +18,7 @@ gem "fog-google", git: "https://github.com/fog/fog-google"
|
|||
gem "rest-client" # If you see this, delete this.
|
||||
gem "pg"
|
||||
gem "batch_api"
|
||||
gem "json-schema-generator"
|
||||
|
||||
# Error reporting tools.
|
||||
# Active on the "official" FarmBot server, set the appropriate ENV
|
||||
|
|
|
@ -114,6 +114,10 @@ GEM
|
|||
domain_name (~> 0.5)
|
||||
i18n (0.7.0)
|
||||
json (1.8.3)
|
||||
json-schema-generator (0.0.9)
|
||||
jsonpath
|
||||
jsonpath (0.5.8)
|
||||
multi_json
|
||||
jwt (1.5.6)
|
||||
launchy (2.4.3)
|
||||
addressable (~> 2.3)
|
||||
|
@ -266,6 +270,7 @@ DEPENDENCIES
|
|||
faker
|
||||
figaro
|
||||
fog-google!
|
||||
json-schema-generator
|
||||
jwt
|
||||
letter_opener
|
||||
mutations (~> 0.8.0)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class JsonSchemaIdea
|
||||
@all = {}
|
||||
require_relative "./doc_page"
|
||||
|
||||
class DocGen
|
||||
@all = {}
|
||||
BLACK_LIST = ["/api/sequences/:id (PATCH)",
|
||||
"/api/sequences (POST)"]
|
||||
|
||||
|
@ -18,7 +19,12 @@ class JsonSchemaIdea
|
|||
@all.select!{|k, v| v.length > 0}
|
||||
# TOO LONG TO DOCUMENT - IGNORE INSTEAD.
|
||||
BLACK_LIST.map {|k| @all.delete(k) }
|
||||
binding.pry
|
||||
@all
|
||||
.map do |key, y|
|
||||
url, verb = key.split(" ")
|
||||
DocPage.new(url, verb, JSON.parse(JSON::SchemaGenerator
|
||||
.generate(key, y.to_json))["items"])
|
||||
end
|
||||
end
|
||||
|
||||
def self.from_json(request)
|
|
@ -0,0 +1,8 @@
|
|||
class DocPage
|
||||
attr_reader :url, :verb, :schema
|
||||
def initialize(url, verb, schema)
|
||||
@url = url
|
||||
@verb = verb
|
||||
@schema = schema
|
||||
end
|
||||
end
|
|
@ -13,7 +13,7 @@ ENV['RAILS_ENV'] ||= 'test'
|
|||
require File.expand_path('../../config/environment', __FILE__)
|
||||
require 'rspec/rails'
|
||||
require_relative './stuff'
|
||||
require_relative './json_schema_idea'
|
||||
require_relative './doc_gen'
|
||||
|
||||
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
||||
|
||||
|
@ -37,12 +37,12 @@ RSpec.configure do |config|
|
|||
|
||||
if ENV['DOCS']
|
||||
config.after(:each, type: :controller) do
|
||||
JsonSchemaIdea.add(request)
|
||||
DocGen.add(request)
|
||||
SmarfDoc.run!(request, response)
|
||||
end
|
||||
|
||||
config.after(:suite) do
|
||||
JsonSchemaIdea.finish!
|
||||
DocGen.finish!#.tap{ |x| binding.pry }
|
||||
SmarfDoc.finish!
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue