Skip to content

Commit

Permalink
Merge branch 'Apipie:master' into response-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
pkwen authored Aug 4, 2021
2 parents ee211a5 + 9fb0b6a commit 6b1650b
Show file tree
Hide file tree
Showing 7 changed files with 391 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Gemfile.local
.ruby-gemset

.DS_Store
rel-eng/.ipynb_checkpoints
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Changelog
===========
## [v0.5.19](https://github.com/Apipie/apipie-rails/tree/v0.5.19) (2021-07-25)
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.18...v0.5.19)
* Add rel-eng notebook (Oleh Fedorenko)
* Correct the word parâmentros for brazilian portuguese [#687](https://github.com/Apipie/apipie-rails/pull/687) (Diego Noronha)
* Fix depreciated file.exists. [#721](https://github.com/Apipie/apipie-rails/pull/721) (Diane Delallée)
* Fix typo in changelog [#703](https://github.com/Apipie/apipie-rails/pull/703) (Pavel Rodionov)
* Add rails 6.1 support in doc generation [#702](https://github.com/Apipie/apipie-rails/pull/702) (andrew-newell)

[v0.5.17](https://github.com/Apipie/apipie-rails/tree/v0.5.18) (2020-05-20)

[v0.5.18](https://github.com/Apipie/apipie-rails/tree/v0.5.18) (2020-05-20)
--------

[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.17...v0.5.18)
Expand Down
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -387,20 +387,20 @@ Example:
end
end
api :POST, "/users", "Create an user"
api :POST, "/users", "Create a user"
param_group :user
def create
# ...
end
api :PUT, "/users/:id", "Update an user"
api :PUT, "/users/:id", "Update a user"
param_group :user
def update
# ...
end
# v2/users_controller.rb
api :POST, "/users", "Create an user"
api :POST, "/users", "Create a user"
param_group :user, V1::UsersController
def create
# ...
Expand Down Expand Up @@ -434,7 +434,7 @@ Example
end
end
api :POST, "/users", "Create an user"
api :POST, "/users", "Create a user"
param_group :user
def create
# ...
Expand All @@ -446,7 +446,7 @@ Example
# ...
end
api :PUT, "/users/:id", "Update an user"
api :PUT, "/users/:id", "Update a user"
param_group :user
def update
# ...
Expand Down
2 changes: 1 addition & 1 deletion config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
optional: opcional
nil_allowed: nulo permitido
param_name: Nome parâmetro
params: Parâmentros
params: Parâmetros
examples: Exemplos
metadata: Metadado
errors: Erros
Expand Down
2 changes: 1 addition & 1 deletion lib/apipie/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Apipie
VERSION = '0.5.18'
VERSION = "0.5.19"
end
16 changes: 8 additions & 8 deletions lib/tasks/apipie.rake
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,14 @@ namespace :apipie do
end

def generate_json_page(file_base, doc, lang = nil)
FileUtils.mkdir_p(file_base) unless File.exists?(file_base)
FileUtils.mkdir_p(file_base) unless File.exist?(file_base)

filename = "schema_apipie#{lang_ext(lang)}.json"
File.open("#{file_base}/#{filename}", 'w') { |file| file.write(JSON.pretty_generate(doc)) }
end

def generate_swagger_json_page(file_base, doc, sfx="", lang = nil)
FileUtils.mkdir_p(file_base) unless File.exists?(file_base)
FileUtils.mkdir_p(file_base) unless File.exist?(file_base)

path = Pathname.new("#{file_base}/schema_swagger#{sfx}#{lang_ext(lang)}.json")
File.open(path, 'w') { |file| file.write(JSON.pretty_generate(doc)) }
Expand All @@ -231,21 +231,21 @@ namespace :apipie do
end

def generate_one_page(file_base, doc, lang = nil)
FileUtils.mkdir_p(File.dirname(file_base)) unless File.exists?(File.dirname(file_base))
FileUtils.mkdir_p(File.dirname(file_base)) unless File.exist?(File.dirname(file_base))

render_page("#{file_base}-onepage#{lang_ext(lang)}.html", "static", {:doc => doc[:docs],
:language => lang, :languages => Apipie.configuration.languages})
end

def generate_plain_page(file_base, doc, lang = nil)
FileUtils.mkdir_p(File.dirname(file_base)) unless File.exists?(File.dirname(file_base))
FileUtils.mkdir_p(File.dirname(file_base)) unless File.exist?(File.dirname(file_base))

render_page("#{file_base}-plain#{lang_ext(lang)}.html", "plain", {:doc => doc[:docs],
:language => lang, :languages => Apipie.configuration.languages}, nil)
end

def generate_index_page(file_base, doc, include_json = false, show_versions = false, lang = nil)
FileUtils.mkdir_p(File.dirname(file_base)) unless File.exists?(File.dirname(file_base))
FileUtils.mkdir_p(File.dirname(file_base)) unless File.exist?(File.dirname(file_base))
versions = show_versions && Apipie.available_versions
render_page("#{file_base}#{lang_ext(lang)}.html", "index", {:doc => doc[:docs],
:versions => versions, :language => lang, :languages => Apipie.configuration.languages})
Expand All @@ -256,7 +256,7 @@ namespace :apipie do
def generate_resource_pages(version, file_base, doc, include_json = false, lang = nil)
doc[:docs][:resources].each do |resource_name, _|
resource_file_base = File.join(file_base, resource_name.to_s)
FileUtils.mkdir_p(File.dirname(resource_file_base)) unless File.exists?(File.dirname(resource_file_base))
FileUtils.mkdir_p(File.dirname(resource_file_base)) unless File.exist?(File.dirname(resource_file_base))

doc = Apipie.to_json(version, resource_name, nil, lang)
doc[:docs][:link_extension] = (lang ? ".#{lang}.html" : ".html")
Expand All @@ -270,7 +270,7 @@ namespace :apipie do
doc[:docs][:resources].each do |resource_name, resource_params|
resource_params[:methods].each do |method|
method_file_base = File.join(file_base, resource_name.to_s, method[:name].to_s)
FileUtils.mkdir_p(File.dirname(method_file_base)) unless File.exists?(File.dirname(method_file_base))
FileUtils.mkdir_p(File.dirname(method_file_base)) unless File.exist?(File.dirname(method_file_base))

doc = Apipie.to_json(version, resource_name, method[:name], lang)
doc[:docs][:link_extension] = (lang ? ".#{lang}.html" : ".html")
Expand Down Expand Up @@ -334,7 +334,7 @@ MESSAGE
desc "Convert your examples from the old yaml into the new json format"
task :convert_examples => :environment do
yaml_examples_file = File.join(Rails.root, Apipie.configuration.doc_path, "apipie_examples.yml")
if File.exists?(yaml_examples_file)
if File.exist?(yaml_examples_file)
#if SafeYAML gem is enabled, it will load examples as an array of Hash, instead of hash
if defined? SafeYAML
examples = YAML.load_file(yaml_examples_file, :safe=>false)
Expand Down
Loading

0 comments on commit 6b1650b

Please sign in to comment.