Move OpenAPI spec from spec/ to openapi/

Naming a directory `spec` in a Ruby project is terribly ambiguous. This
clarifies the purpose of this directory and makes it easier to find if
you know that you're looking for OpenAPI.
This commit is contained in:
Brandur 2017-03-14 16:53:43 -07:00
parent 3b193db847
commit 4d7019bee6
8 changed files with 6 additions and 6 deletions

View File

@ -142,7 +142,7 @@ Update bundled CA certificates from the [Mozilla cURL release][curl]:
Update bundled OpenAPI specification from the canonical repository: Update bundled OpenAPI specification from the canonical repository:
bundle exec rake update_spec bundle exec rake update_openapi
[api-keys]: https://dashboard.stripe.com/account/apikeys [api-keys]: https://dashboard.stripe.com/account/apikeys
[connect]: https://stripe.com/connect [connect]: https://stripe.com/connect

View File

@ -15,13 +15,13 @@ task :update_certs do
end end
desc "Update OpenAPI specification" desc "Update OpenAPI specification"
task :update_spec do task :update_openapi do
require "faraday" require "faraday"
["fixtures.json", "fixtures.yaml", "spec.json", "spec.yaml"].map { |file| ["fixtures.json", "fixtures.yaml", "spec.json", "spec.yaml"].map { |file|
Thread.new do Thread.new do
fetch_file "https://raw.githubusercontent.com/stripe/openapi/master/spec/#{file}", fetch_file "https://raw.githubusercontent.com/stripe/openapi/master/spec/#{file}",
File.expand_path("../spec/#{file}", __FILE__) File.expand_path("../openapi/#{file}", __FILE__)
end end
}.map { |t| t.join } }.map { |t| t.join }
end end

View File

@ -3,7 +3,7 @@
# tests. # tests.
class APIFixtures class APIFixtures
def initialize def initialize
@fixtures = ::JSON.parse(File.read("#{PROJECT_ROOT}/spec/fixtures.json"), @fixtures = ::JSON.parse(File.read("#{PROJECT_ROOT}/openapi/fixtures.json"),
symbolize_names: true) symbolize_names: true)
freeze_recursively(@fixtures) freeze_recursively(@fixtures)
end end

View File

@ -95,10 +95,10 @@ module APIStubHelpers
end end
end end
# Finds the latest OpenAPI specification in ROOT/spec/ and parses it for # Finds the latest OpenAPI specification in ROOT/openapi/ and parses it for
# use with Committee. # use with Committee.
def self.initialize_spec def self.initialize_spec
schema_data = ::JSON.parse(File.read("#{PROJECT_ROOT}/spec/spec.json")) schema_data = ::JSON.parse(File.read("#{PROJECT_ROOT}/openapi/spec.json"))
driver = Committee::Drivers::OpenAPI2.new driver = Committee::Drivers::OpenAPI2.new
driver.parse(schema_data) driver.parse(schema_data)