-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f6a8c0
commit 29641b5
Showing
6 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
openapi: 3.0.1 | ||
info: | ||
title: API V1 | ||
version: v1 | ||
servers: | ||
- url: http://example.com | ||
paths: | ||
"/api/stores": | ||
get: | ||
summary: Получение магазинов | ||
parameters: | ||
- name: lat | ||
in: query | ||
required: true | ||
schema: | ||
type: number | ||
- name: lon | ||
in: query | ||
required: true | ||
schema: | ||
type: number | ||
responses: | ||
'200': | ||
description: Success | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
openapi: 3.0.1 | ||
info: | ||
title: Delivery Conditions API | ||
version: v1 | ||
paths: {} | ||
components: | ||
schemas: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
require "swagger_helper" | ||
|
||
describe Api::StoresController, swagger_doc: "api.yaml" do | ||
path "/api/stores" do | ||
get "Получение магазинов" do | ||
consumes "application/json" | ||
produces "application/json" | ||
|
||
parameter name: :lat, | ||
in: :query, | ||
type: :number, | ||
required: true | ||
|
||
parameter name: :lon, | ||
in: :query, | ||
type: :number, | ||
required: true | ||
|
||
let(:lon) { 5 } | ||
let(:lat) { 5 } | ||
|
||
context "with success stf proxy mode", vcr: "api/stores_post_success" do # rubocop:disable RSpec/EmptyExampleGroup | ||
response "200", "Success" do | ||
schema({ | ||
type: "array", | ||
items: {type: "string"} | ||
}) | ||
|
||
run_test! | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rswag/specs" | ||
|
||
RSpec.configure do |config| | ||
# Specify a root folder where Swagger JSON files are generated | ||
# NOTE: If you're using the rswag-api to serve API descriptions, you'll need | ||
# to ensure that it's configured to serve Swagger from the same folder | ||
config.openapi_root = Rails.root.join("openapi").to_s | ||
|
||
# Define one or more Swagger documents and provide global metadata for each one | ||
# When you run the 'rswag:specs:swaggerize' rake task, the complete Swagger will | ||
# be generated at the provided relative path under swagger_root | ||
# By default, the operations defined in spec files are added to the first | ||
# document below. You can override this behavior by adding a swagger_doc tag to the | ||
# the root example_group in your specs, e.g. describe '...', swagger_doc: 'v2.yaml' | ||
config.openapi_specs = { | ||
"api.yaml" => { | ||
openapi: "3.0.1", | ||
info: { | ||
title: "API V1", | ||
version: "v1" | ||
}, | ||
servers: [ | ||
{ | ||
url: "http://example.com" | ||
} | ||
] | ||
} | ||
} | ||
|
||
# Specify the format of the output Swagger file when running 'rswag:specs:swaggerize'. | ||
# The swagger_docs configuration option has the filename including format in | ||
# the key, this may want to be changed to avoid putting yaml in json files. | ||
# Defaults to json. Accepts ':json' and ':yaml'. | ||
config.openapi_format = :yaml | ||
end |