lib/open_api/config.rb in zero-rails_openapi-1.3.3 vs lib/open_api/config.rb in zero-rails_openapi-1.4.0
- old
+ new
@@ -12,16 +12,20 @@
cattr_accessor :generate_doc do
true
end
+ cattr_accessor :rails_routes_file do
+ nil
+ end
+
# Everything about OAS3 is on https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md
# Getting started: https://swagger.io/docs/specification/basic-structure/
- cattr_accessor :register_docs do
+ cattr_accessor :open_api_docs do
{
# # [REQUIRED] At least one doc.
- # zero_rails_api: {
+ # zero_rails: {
# # [REQUIRED] ZRO will scan all the descendants of the root_controller, and then generate their docs.
# root_controller: ApplicationController,
#
# # [REQUIRED] Info Object: The info section contains API information
# info: {
@@ -34,11 +38,11 @@
# }
}
end
cattr_accessor :is_options do
- %w[ email phone password uuid uri url time date ]
+ %w[ email phone mobile password uuid uri url time date ]
end
cattr_accessor :dft_file_format do
'binary'
end
@@ -50,60 +54,13 @@
cattr_accessor :overwrite_jbuilder_file do
false
end
cattr_accessor :jbuilder_templates do
- {
- index: (
- <<~FILE
- # *** Generated by ZRO [ please make sure that you have checked this file ] ***
- json.partial! 'api/base', total: @data.size
-
- json.data do
- # @data = @data.page(@_page).per(@_rows) if @_page || @_rows
- # json.array! @data do |datum|
- json.array! @data.page(@_page).per(@_rows) do |datum|
- json.(datum, *datum.show_attrs) if datum.present?
- end
- end
- FILE
- ),
-
- show: (
- <<~FILE
- # *** Generated by ZRO [ please make sure that you have checked this file ] ***
- json.partial! 'api/base', total: 1
-
- json.data do
- json.array! [ @data ] do |datum|
- json.(datum, *datum.show_attrs) if datum.present?
- end
- end
- FILE
- ),
-
- success: (
- <<~FILE
- # *** Generated by ZRO [ please make sure that you have checked this file ] ***
- json.partial! 'api/success'
- FILE
- ),
-
- success_or_not: (
- <<~FILE
- # *** Generated by ZRO [ please make sure that you have checked this file ] ***
- unless @status
- # @_code, @_msg = @error_info.present? ? @error_info : ApiError.action_failed.info
- end
-
- json.partial! 'api/base', total: 0
- json.data ''
- FILE
- ),
- }
+ { }
end
def self.docs
- register_docs
+ open_api_docs
end
end
end