Project

General

Profile

« Previous | Next » 

Revision 3398b5bd

Added by Petr Chalupa over 11 years ago

  • ID 3398b5bde612cc6818c5882be9158d7693e2b07f

update api documentation

  • remove #set_resource_params from Api::BaseController to leave :id param under :id for apipie validations to work
  • fix custom apipie validators to return nice errors
  • enable apipie validations for bugs to be caught early
  • log apipie param errors with info level
  • add missing documentation, :search, :order and params from url (:id)
  • add missing :allow_nil options in api documentation

View differences:

app/controllers/api/v1/operatingsystems_controller.rb
before_filter :find_resource, :only => %w{show edit update destroy bootfiles}
api :GET, "/operatingsystems/", "List all operating systems."
param :search, String, :desc => "filter results", :required => false
param :order, String, :desc => "sort results", :required => false, :desc => "for example, name ASC, or name DESC"
def index
@operatingsystems = Operatingsystem.all
@operatingsystems = Operatingsystem.search_for(params[:search], :order => params[:order])
end
api :GET, "/operatingsystems/:id/", "Show an OS."
param :id, String, :required => true
def show
end
......
end
api :PUT, "/operatingsystems/:id/", "Update an OS."
param :id, String, :required => true
param :operatingsystem, Hash, :required => true do
param :name, /\A(\S+)\Z/
param :major, String
......
end
api :DELETE, "/operatingsystems/:id/", "Delete a bookmark."
param :id, String, :required => true
def destroy
process_response @operatingsystem.destroy
end
api :GET, "/operatingsystems/:id/bootfiles/", "List boot files an OS."
param :id, String, :required => true
param :medium, String
param :architecture, String
def bootfiles

Also available in: Unified diff