Open
Description
Minor weirdness/inconsistency between a stock rails/oas app created using --api
and not. For the --api
variant it behaves as expected, but if I have a regular rails app with json api as part of regular html controllers, then the api docs setup a default 200 response code for create actions instead of 201 (:created
), and oddly enough show a validation error schema for it (instead of for the 422). The --api
variant has a 201 with a Post and a 422 with the validation schema
From a rails generate scaffold:
def create
@post = Post.new(post_params)
respond_to do |format|
if @post.save
format.html { redirect_to @post, notice: "Post was successfully created." }
format.json { render :show, status: :created, location: @post }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end