Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # frozen_string_literal: true
- require "rails_helper"
- 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.swagger_root = Rails.root.to_s + "/swagger"
- # Define one or more Swagger documents and provide global metadata for each one
- # When you run the 'rswag:specs:to_swagger' 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/swagger.json'
- config.swagger_docs = {
- "v1/swagger.json" => {
- swagger: "2.0",
- info: {
- title: "Shop API V1",
- description: "https://shopcollabora.jowi.club/",
- version: "1.0",
- contact: {
- name: "API Support",
- email: "madrahimov.ilhom@gmail.com, emiralievlenur@gmail.com"
- }
- },
- tags: [
- {
- name: "Cities",
- description: "Countries And cities"
- },
- {
- name: "Registration",
- description: "User Registration"
- },
- {
- name: "Authorization",
- description: "User Authorization"
- },
- {
- name: "Reset Password",
- description: "User Reset Password"
- },
- {
- name: "Companies",
- description: "User Companies"
- },
- {
- name: "Currencies",
- description: "Currencies"
- },
- {
- name: "Shops",
- description: "Shops"
- },
- {
- name: "Categories",
- description: "Categories"
- },
- {
- name: "Tags",
- description: "Tags"
- },
- {
- name: "Stocks",
- description: "Stocks"
- },
- {
- name: "Settings Currencies",
- description: "Валюты магазина. Добавление/обновление через единый метод."
- },
- {
- name: "Settings Units",
- description: "Ед. измерения магазина. Включение и выключение через один метод."
- },
- {
- name: "Settings Taxes",
- description: "Налоги магазина. Если is_edit = false, то его нелья менять и удалять."
- }
- ],
- # host: "https://shopapi.jowi.club",
- # host: "localhost:3000",
- basePath: "/v1",
- securityDefinitions: {
- bearerAuth: {
- type: :apiKey,
- name: "Authorization",
- in: :header
- }
- },
- # schemes: ["http", "https"],
- consumes: "application/json",
- produces: "application/json",
- definitions: {
- DefaultSuccessResponse: {
- required: [:success],
- type: :object,
- properties: {
- success: { type: :boolean, default: true }
- }
- },
- DefaultErrorResponse: {
- required: [:errors],
- type: :object,
- properties: {
- errors: {
- type: :array,
- items: {
- required: [:id, :code, :title],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- code: { type: :integer, format: :int32 },
- title: { type: :string }
- }
- }
- }
- }
- },
- CategoryObject: {
- required: [:id, :name, :children],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- name: { type: :string },
- children: {
- type: :array,
- items: {
- schema: {
- "$ref" => "#/definitions/CategoryObject"
- }
- }
- }
- }
- },
- TagObject: {
- required: [:id, :name, :is_active],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- name: { type: :string }
- }
- },
- StockObject: {
- required: [:id, :name, :country_id, :city_id, :address, :write_off_type],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- name: { type: :string },
- description: { type: :string },
- country_id: { type: :string, format: :uuid },
- city_id: { type: :string, format: :uuid },
- address: { type: :string },
- write_off_type: { type: :string }
- }
- },
- StockUserObject: {
- required: [:id, :first_name, :phone, :email],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- first_name: { type: :string },
- last_name: { type: :string },
- phone: { type: :string },
- email: { type: :string, format: :email }
- }
- },
- ProductObject: {
- required: [:id, :name, :unit_id, :shop_tax_id, :category_id, :cost_price, :markup, :price, :sku, :is_published, :disabe_price_block],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- name: { type: :string },
- text: { type: :string },
- unit_id: { type: :string, format: :uuid },
- shop_tax_id: { type: :string, format: :uuid },
- category_id: { type: :string, format: :uuid },
- cost_price: { type: :integer, format: :float },
- markup: { type: :integer, format: :float },
- price: { type: :integer, format: :float },
- sku: { type: :string },
- is_published: { type: :boolean },
- disabe_price_block: { type: :boolean }
- }
- },
- ProductTag: {
- required: [:id, :name],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- name: { type: :string }
- }
- },
- ProductVendorCode: {
- required: [:id, :vendor_code],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- vendor_code: { type: :string }
- }
- },
- ProductBarcode: {
- required: [:id, :barcode_type, :barcode],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- barcode_type: { type: :string },
- barcode: { type: :string }
- }
- },
- ProductPack: {
- required: [:id, :name, :count],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- name: { type: :string },
- count: { type: :integer, format: :int32 }
- }
- },
- ProductImage: {
- required: [:id, :name, :url, :position],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- name: { type: :string },
- url: { type: :string },
- position: { type: :integer, format: :int32 }
- }
- },
- ProductOptionType: {
- required: [:id, :product_option_type_values],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- product_option_type_values: {
- type: :array,
- items: {
- required: [:id, :name],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- name: { type: :string }
- }
- }
- }
- }
- },
- ProductVariant: {
- required: [:id, :cost_price, :markup, :price, :sku, :vendor_code, :is_published, :position, :by_price_list, :variant_option_type_values, :variant_images],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- cost_price: { type: :integer, format: :float },
- markup: { type: :integer, format: :float },
- price: { type: :integer, format: :int32 },
- sku: { type: :string },
- vendor_code: { type: :string },
- is_published: { type: :boolean },
- position: { type: :integer, format: :int32 },
- by_price_list: { type: :boolean },
- variant_option_type_values: {
- type: :array,
- items: {
- required: [:id, :name, :option_type_id],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- name: { type: :string },
- option_type_id: { type: :string, format: :uuid }
- }
- }
- },
- variant_images: {
- type: :array,
- items: {
- required: [:id, :name, :url, :position],
- type: :object,
- properties: {
- id: { type: :string, format: :uuid },
- name: { type: :string },
- url: { type: :string },
- position: { type: :integer, format: :int32 }
- }
- }
- }
- }
- },
- DocumentObject: {
- type: :object,
- required: [:type, :date, :stock_id, :currency_id, :shop_id],
- properties: {
- type: { type: :string },
- date: { type: :date },
- document_date: { type: :date },
- invoice_date: { type: :date },
- document_number: { type: :string },
- invoice_number: { type: :string },
- status: { type: :string },
- additional_cost: { type: :float },
- note: { type: :string },
- stock_id: { type: :string, format: :uuid },
- currency_id: { type: :string, format: :uuid },
- shop_id: { type: :string, format: :uuid }
- }
- }
- }
- }
- }
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement