Skip to content

Instantly share code, notes, and snippets.

@ota42y
Last active Jun 2, 2020
Embed
What would you like to do?
schema_path = Rails.root.join("config/openapi.yaml").to_s
config.middleware.use Committee::Middleware::RequestValidation,
schema_path: schema_path,
params_key: 'action_dispatch.request.request_parameters'
openapi: 3.0.0
info:
title: api-test
version: '1.0'
servers:
- url: 'http://localhost:3000'
paths:
/users:
post:
parameters:
- in: query
name: page
schema:
type: integer
requestBody:
content:
application/json:
schema:
type: object
required:
- registered_at
properties:
age:
type: integer
registered_at:
type: string
format: "date-time"
responses:
'204':
description: No Content
content:
application/json:
schema:
type: object
class UsersController < ApplicationController
skip_before_action :verify_authenticity_token
def create
binding.pry
registered_at = params[:registered_at]
raise "error" unless registered_at < Time.now
user = ["debug user1"] # do something
head :ok
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment