Single Table Inheritance
Single Table Inheritance with automatic variant serialization and TypeScript union types
API Definition
config/apis/mighty_wolf.rb
rb
# frozen_string_literal: true
Apiwork::API.define '/mighty_wolf' do
key_format :camel
export :openapi
export :typescript
export :zod
resources :vehicles
endModels
app/models/mighty_wolf/vehicle.rb
rb
# frozen_string_literal: true
module MightyWolf
class Vehicle < ApplicationRecord
validates :brand, :model, presence: true
end
endDatabase Table
| Column | Type | Nullable | Default |
|---|---|---|---|
| id | string | ||
| brand | string | ||
| color | string | ✓ | |
| created_at | datetime | ||
| doors | integer | ✓ | |
| engine_cc | integer | ✓ | |
| model | string | ||
| payload_capacity | decimal | ✓ | |
| type | string | ||
| updated_at | datetime | ||
| year | integer | ✓ |
app/models/mighty_wolf/car.rb
rb
# frozen_string_literal: true
module MightyWolf
class Car < Vehicle
end
endapp/models/mighty_wolf/truck.rb
rb
# frozen_string_literal: true
module MightyWolf
class Truck < Vehicle
end
endapp/models/mighty_wolf/motorcycle.rb
rb
# frozen_string_literal: true
module MightyWolf
class Motorcycle < Vehicle
end
endRepresentations
app/representations/mighty_wolf/vehicle_representation.rb
rb
# frozen_string_literal: true
module MightyWolf
class VehicleRepresentation < Apiwork::Representation::Base
attribute :id
attribute :type, filterable: true
attribute :brand, filterable: true, writable: true
attribute :model, filterable: true, writable: true
attribute :year, filterable: true, sortable: true, writable: true
attribute :color, writable: true
attribute :created_at
attribute :updated_at
end
endapp/representations/mighty_wolf/car_representation.rb
rb
# frozen_string_literal: true
module MightyWolf
class CarRepresentation < VehicleRepresentation
type_name :car
attribute :doors, writable: true
end
endapp/representations/mighty_wolf/truck_representation.rb
rb
# frozen_string_literal: true
module MightyWolf
class TruckRepresentation < VehicleRepresentation
type_name :truck
attribute :payload_capacity, writable: true
end
endapp/representations/mighty_wolf/motorcycle_representation.rb
rb
# frozen_string_literal: true
module MightyWolf
class MotorcycleRepresentation < VehicleRepresentation
type_name :motorcycle
attribute :engine_cc, writable: true
end
endContracts
app/contracts/mighty_wolf/vehicle_contract.rb
rb
# frozen_string_literal: true
module MightyWolf
class VehicleContract < Apiwork::Contract::Base
representation VehicleRepresentation
end
endControllers
app/controllers/mighty_wolf/vehicles_controller.rb
rb
# frozen_string_literal: true
module MightyWolf
class VehiclesController < ApplicationController
before_action :set_vehicle, only: %i[show update destroy]
def index
vehicles = Vehicle.all
expose vehicles
end
def show
expose vehicle
end
def create
vehicle = Vehicle.create(contract.body[:vehicle])
expose vehicle
end
def update
vehicle.update(contract.body[:vehicle])
expose vehicle
end
def destroy
vehicle.destroy
expose vehicle
end
private
attr_reader :vehicle
def set_vehicle
@vehicle = Vehicle.find(params[:id])
end
end
endRequest Examples
List all vehicles
Request
http
GET /mighty_wolf/vehiclesResponse 200
json
{
"vehicles": [
{
"type": "car",
"id": "7900de74-233c-5bc9-bc0c-6679f7a345a5",
"brand": "Volvo",
"model": "EX30",
"year": null,
"color": null,
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"doors": 4
},
{
"type": "motorcycle",
"id": "7806556d-7175-57da-9ab8-a1d92437b144",
"brand": "Harley-Davidson",
"model": "Street Glide",
"year": null,
"color": null,
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"engineCc": 1868
},
{
"type": "truck",
"id": "0cfa971d-c697-5cff-be68-cf775df891c1",
"brand": "Ford",
"model": "F-150",
"year": null,
"color": null,
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"payloadCapacity": "5000.0"
}
],
"pagination": {
"items": 3,
"total": 1,
"current": 1,
"next": null,
"prev": null
}
}Get vehicle details
Request
http
GET /mighty_wolf/vehicles/7900de74-233c-5bc9-bc0c-6679f7a345a5Response 200
json
{
"vehicle": {
"type": "car",
"id": "7900de74-233c-5bc9-bc0c-6679f7a345a5",
"brand": "Volvo",
"model": "EX30",
"year": 2024,
"color": "red",
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"doors": 4
}
}Create a car
Request
http
POST /mighty_wolf/vehicles
Content-Type: application/json
{
"vehicle": {
"type": "car",
"brand": "Volvo",
"model": "EX30",
"year": 2024,
"color": "red",
"doors": 4
}
}Response 201
json
{
"vehicle": {
"type": "car",
"id": "7900de74-233c-5bc9-bc0c-6679f7a345a5",
"brand": "Volvo",
"model": "EX30",
"year": 2024,
"color": "red",
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"doors": 4
}
}Create a truck
Request
http
POST /mighty_wolf/vehicles
Content-Type: application/json
{
"vehicle": {
"type": "truck",
"brand": "Ford",
"model": "F-150",
"year": 2024,
"color": "blue",
"payloadCapacity": 5000
}
}Response 201
json
{
"vehicle": {
"type": "truck",
"id": "0cfa971d-c697-5cff-be68-cf775df891c1",
"brand": "Ford",
"model": "F-150",
"year": 2024,
"color": "blue",
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"payloadCapacity": "5000.0"
}
}Filter by vehicle type
Request
http
GET /mighty_wolf/vehicles?filter[type][eq]=carResponse 200
json
{
"vehicles": [
{
"type": "car",
"id": "7900de74-233c-5bc9-bc0c-6679f7a345a5",
"brand": "Volvo",
"model": "EX30",
"year": null,
"color": null,
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"doors": null
}
],
"pagination": {
"items": 1,
"total": 1,
"current": 1,
"next": null,
"prev": null
}
}Generated Output
Introspection
json
{
"base_path": "/mighty_wolf",
"enums": {
"layer": {
"deprecated": false,
"description": null,
"example": null,
"values": [
"http",
"contract",
"domain"
]
},
"sort_direction": {
"deprecated": false,
"description": null,
"example": null,
"values": [
"asc",
"desc"
]
},
"vehicle_type": {
"deprecated": false,
"description": null,
"example": null,
"values": [
"car",
"motorcycle",
"truck"
]
}
},
"error_codes": {
"unprocessable_entity": {
"description": "Unprocessable Entity",
"status": 422
}
},
"info": null,
"resources": {
"vehicles": {
"actions": {
"index": {
"deprecated": false,
"description": null,
"method": "get",
"operation_id": null,
"path": "/vehicles",
"raises": [],
"request": {
"body": {},
"query": {
"filter": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "vehicle_filter"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "vehicle_filter"
},
"shape": {}
}
]
},
"page": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "vehicle_page"
},
"sort": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "vehicle_sort"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "vehicle_sort"
},
"shape": {}
}
]
}
}
},
"response": {
"body": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "vehicle_index_success_response_body"
},
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "error_response_body"
}
]
},
"no_content": false
},
"summary": null,
"tags": []
},
"show": {
"deprecated": false,
"description": null,
"method": "get",
"operation_id": null,
"path": "/vehicles/:id",
"raises": [],
"request": {
"body": {},
"query": {}
},
"response": {
"body": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "vehicle_show_success_response_body"
},
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "error_response_body"
}
]
},
"no_content": false
},
"summary": null,
"tags": []
},
"create": {
"deprecated": false,
"description": null,
"method": "post",
"operation_id": null,
"path": "/vehicles",
"raises": [
"unprocessable_entity"
],
"request": {
"body": {
"vehicle": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "union",
"discriminator": "type",
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "car_create_payload"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "motorcycle_create_payload"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "truck_create_payload"
}
]
}
},
"query": {}
},
"response": {
"body": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "vehicle_create_success_response_body"
},
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "error_response_body"
}
]
},
"no_content": false
},
"summary": null,
"tags": []
},
"update": {
"deprecated": false,
"description": null,
"method": "patch",
"operation_id": null,
"path": "/vehicles/:id",
"raises": [
"unprocessable_entity"
],
"request": {
"body": {
"vehicle": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "union",
"discriminator": "type",
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "car_update_payload"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "motorcycle_update_payload"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "truck_update_payload"
}
]
}
},
"query": {}
},
"response": {
"body": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "vehicle_update_success_response_body"
},
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "error_response_body"
}
]
},
"no_content": false
},
"summary": null,
"tags": []
},
"destroy": {
"deprecated": false,
"description": null,
"method": "delete",
"operation_id": null,
"path": "/vehicles/:id",
"raises": [],
"request": {
"body": {},
"query": {}
},
"response": {
"body": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": null
},
"no_content": true
},
"summary": null,
"tags": []
}
},
"identifier": "vehicles",
"parent_identifiers": [],
"path": "vehicles",
"resources": {}
}
},
"types": {
"car": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"color": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"created_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
},
"doors": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"id": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"updated_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"car_create_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"color": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"doors": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "literal",
"value": "car"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"car_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"AND": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "car_filter"
},
"shape": {}
},
"NOT": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "car_filter"
},
"OR": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "car_filter"
},
"shape": {}
},
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "string_filter"
}
]
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "string_filter"
}
]
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "type_filter"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "nullable_integer_filter"
}
]
}
},
"type": "object",
"variants": []
},
"car_sort": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
}
},
"type": "object",
"variants": []
},
"car_update_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"color": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"doors": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "literal",
"value": "car"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"error": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"issues": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "issue"
},
"shape": {}
},
"layer": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "layer"
}
},
"type": "object",
"variants": []
},
"error_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [
"error"
],
"shape": {},
"type": "object",
"variants": []
},
"integer_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"between": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "integer_filter_between"
},
"eq": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"gt": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"gte": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"in": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"shape": {}
},
"lt": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"lte": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"integer_filter_between": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"from": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"to": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"issue": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"code": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"detail": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "object",
"partial": false,
"shape": {}
},
"path": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "string",
"format": null,
"max": null,
"min": null
},
"shape": {}
},
"pointer": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"motorcycle": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"color": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"created_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
},
"engine_cc": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"id": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"updated_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"motorcycle_create_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"color": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"engine_cc": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "literal",
"value": "motorcycle"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"motorcycle_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"AND": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "motorcycle_filter"
},
"shape": {}
},
"NOT": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "motorcycle_filter"
},
"OR": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "motorcycle_filter"
},
"shape": {}
},
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "string_filter"
}
]
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "string_filter"
}
]
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "type_filter"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "nullable_integer_filter"
}
]
}
},
"type": "object",
"variants": []
},
"motorcycle_sort": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
}
},
"type": "object",
"variants": []
},
"motorcycle_update_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"color": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"engine_cc": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "literal",
"value": "motorcycle"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"nullable_integer_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"between": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "integer_filter_between"
},
"eq": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"gt": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"gte": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"in": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"shape": {}
},
"lt": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"lte": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"null": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "boolean"
}
},
"type": "object",
"variants": []
},
"offset_pagination": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"current": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"items": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"next": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"prev": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"total": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"string_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"contains": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"ends_with": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"eq": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"in": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "string",
"format": null,
"max": null,
"min": null
},
"shape": {}
},
"starts_with": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"truck": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"color": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"created_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
},
"id": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"payload_capacity": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "decimal",
"max": null,
"min": null
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"updated_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"truck_create_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"color": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"payload_capacity": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "decimal",
"max": null,
"min": null
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "literal",
"value": "truck"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"truck_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"AND": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "truck_filter"
},
"shape": {}
},
"NOT": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "truck_filter"
},
"OR": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "truck_filter"
},
"shape": {}
},
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "string_filter"
}
]
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "string_filter"
}
]
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "type_filter"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "nullable_integer_filter"
}
]
}
},
"type": "object",
"variants": []
},
"truck_sort": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
}
},
"type": "object",
"variants": []
},
"truck_update_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"color": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"payload_capacity": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "decimal",
"max": null,
"min": null
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "literal",
"value": "truck"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"vehicle": {
"deprecated": false,
"description": null,
"discriminator": "type",
"example": null,
"extends": [],
"shape": {},
"type": "union",
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "car"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "motorcycle"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "truck"
}
]
},
"vehicle_create_payload": {
"deprecated": false,
"description": null,
"discriminator": "type",
"example": null,
"extends": [],
"shape": {},
"type": "union",
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "car_create_payload"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "motorcycle_create_payload"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "truck_create_payload"
}
]
},
"vehicle_create_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
},
"vehicle": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "vehicle"
}
},
"type": "object",
"variants": []
},
"vehicle_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"AND": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "vehicle_filter"
},
"shape": {}
},
"NOT": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "vehicle_filter"
},
"OR": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "vehicle_filter"
},
"shape": {}
},
"brand": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "string_filter"
}
]
},
"model": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "string_filter"
}
]
},
"type": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "vehicle_type_filter"
},
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "nullable_integer_filter"
}
]
}
},
"type": "object",
"variants": []
},
"vehicle_index_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"pagination": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "offset_pagination"
},
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
},
"vehicles": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "vehicle"
},
"shape": {}
}
},
"type": "object",
"variants": []
},
"vehicle_page": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"number": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": 1
},
"size": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": 100,
"min": 1
}
},
"type": "object",
"variants": []
},
"vehicle_show_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
},
"vehicle": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "vehicle"
}
},
"type": "object",
"variants": []
},
"vehicle_sort": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"year": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
}
},
"type": "object",
"variants": []
},
"vehicle_type_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {},
"type": "union",
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "vehicle_type"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "object",
"partial": true,
"shape": {
"eq": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "vehicle_type"
},
"in": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "vehicle_type"
},
"shape": {}
}
}
}
]
},
"vehicle_update_payload": {
"deprecated": false,
"description": null,
"discriminator": "type",
"example": null,
"extends": [],
"shape": {},
"type": "union",
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "car_update_payload"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "motorcycle_update_payload"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "truck_update_payload"
}
]
},
"vehicle_update_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
},
"vehicle": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "vehicle"
}
},
"type": "object",
"variants": []
}
}
}TypeScript
ts
export interface Car {
brand: string;
color: null | string;
createdAt: string;
doors: null | number;
id: string;
model: string;
type: string;
updatedAt: string;
year: null | number;
}
export interface CarCreatePayload {
brand: string;
color?: null | string;
doors?: null | number;
model: string;
type: 'car';
year?: null | number;
}
export interface CarUpdatePayload {
brand?: string;
color?: null | string;
doors?: null | number;
model?: string;
type?: 'car';
year?: null | number;
}
export interface Error {
issues: Issue[];
layer: Layer;
}
export type ErrorResponseBody = Error;
export interface IntegerFilterBetween {
from?: number;
to?: number;
}
export interface Issue {
code: string;
detail: string;
meta: Record<string, unknown>;
path: string[];
pointer: string;
}
export type Layer = 'contract' | 'domain' | 'http';
export interface Motorcycle {
brand: string;
color: null | string;
createdAt: string;
engineCc: null | number;
id: string;
model: string;
type: string;
updatedAt: string;
year: null | number;
}
export interface MotorcycleCreatePayload {
brand: string;
color?: null | string;
engineCc?: null | number;
model: string;
type: 'motorcycle';
year?: null | number;
}
export interface MotorcycleUpdatePayload {
brand?: string;
color?: null | string;
engineCc?: null | number;
model?: string;
type?: 'motorcycle';
year?: null | number;
}
export interface NullableIntegerFilter {
between?: IntegerFilterBetween;
eq?: number;
gt?: number;
gte?: number;
in?: number[];
lt?: number;
lte?: number;
null?: boolean;
}
export interface OffsetPagination {
current: number;
items: number;
next?: null | number;
prev?: null | number;
total: number;
}
export type SortDirection = 'asc' | 'desc';
export interface StringFilter {
contains?: string;
endsWith?: string;
eq?: string;
in?: string[];
startsWith?: string;
}
export interface Truck {
brand: string;
color: null | string;
createdAt: string;
id: string;
model: string;
payloadCapacity: null | number;
type: string;
updatedAt: string;
year: null | number;
}
export interface TruckCreatePayload {
brand: string;
color?: null | string;
model: string;
payloadCapacity?: null | number;
type: 'truck';
year?: null | number;
}
export interface TruckUpdatePayload {
brand?: string;
color?: null | string;
model?: string;
payloadCapacity?: null | number;
type?: 'truck';
year?: null | number;
}
export type Vehicle = Car | Motorcycle | Truck;
export interface VehicleCreateSuccessResponseBody {
meta?: Record<string, unknown>;
vehicle: Vehicle;
}
export interface VehicleFilter {
AND?: VehicleFilter[];
NOT?: VehicleFilter;
OR?: VehicleFilter[];
brand?: StringFilter | string;
model?: StringFilter | string;
type?: VehicleTypeFilter;
year?: NullableIntegerFilter | number;
}
export interface VehicleIndexSuccessResponseBody {
meta?: Record<string, unknown>;
pagination: OffsetPagination;
vehicles: Vehicle[];
}
export interface VehiclePage {
number?: number;
size?: number;
}
export interface VehicleShowSuccessResponseBody {
meta?: Record<string, unknown>;
vehicle: Vehicle;
}
export interface VehicleSort {
year?: SortDirection;
}
export type VehicleType = 'car' | 'motorcycle' | 'truck';
export type VehicleTypeFilter = VehicleType | { eq?: VehicleType; in?: VehicleType[] };
export interface VehicleUpdateSuccessResponseBody {
meta?: Record<string, unknown>;
vehicle: Vehicle;
}
export interface VehiclesCreateRequest {
body: VehiclesCreateRequestBody;
}
export interface VehiclesCreateRequestBody {
vehicle: CarCreatePayload | MotorcycleCreatePayload | TruckCreatePayload;
}
export interface VehiclesCreateResponse {
body: VehiclesCreateResponseBody;
}
export type VehiclesCreateResponseBody = ErrorResponseBody | VehicleCreateSuccessResponseBody;
export type VehiclesDestroyResponse = never;
export interface VehiclesIndexRequest {
query: VehiclesIndexRequestQuery;
}
export interface VehiclesIndexRequestQuery {
filter?: VehicleFilter | VehicleFilter[];
page?: VehiclePage;
sort?: VehicleSort | VehicleSort[];
}
export interface VehiclesIndexResponse {
body: VehiclesIndexResponseBody;
}
export type VehiclesIndexResponseBody = ErrorResponseBody | VehicleIndexSuccessResponseBody;
export interface VehiclesShowResponse {
body: VehiclesShowResponseBody;
}
export type VehiclesShowResponseBody = ErrorResponseBody | VehicleShowSuccessResponseBody;
export interface VehiclesUpdateRequest {
body: VehiclesUpdateRequestBody;
}
export interface VehiclesUpdateRequestBody {
vehicle: CarUpdatePayload | MotorcycleUpdatePayload | TruckUpdatePayload;
}
export interface VehiclesUpdateResponse {
body: VehiclesUpdateResponseBody;
}
export type VehiclesUpdateResponseBody = ErrorResponseBody | VehicleUpdateSuccessResponseBody;Zod
ts
import { z } from 'zod';
export const LayerSchema = z.enum(['contract', 'domain', 'http']);
export const SortDirectionSchema = z.enum(['asc', 'desc']);
export const VehicleTypeSchema = z.enum(['car', 'motorcycle', 'truck']);
export const VehicleFilterSchema: z.ZodType<VehicleFilter> = z.lazy(() => z.object({
AND: z.array(VehicleFilterSchema).optional(),
NOT: VehicleFilterSchema.optional(),
OR: z.array(VehicleFilterSchema).optional(),
brand: z.union([z.string(), StringFilterSchema]).optional(),
model: z.union([z.string(), StringFilterSchema]).optional(),
type: VehicleTypeFilterSchema.optional(),
year: z.union([z.number().int(), NullableIntegerFilterSchema]).optional()
}));
export const CarSchema = z.object({
brand: z.string(),
color: z.string().nullable(),
createdAt: z.iso.datetime(),
doors: z.number().int().nullable(),
id: z.string(),
model: z.string(),
type: z.string(),
updatedAt: z.iso.datetime(),
year: z.number().int().nullable()
});
export const CarCreatePayloadSchema = z.object({
brand: z.string(),
color: z.string().nullable().optional(),
doors: z.number().int().nullable().optional(),
model: z.string(),
type: z.literal('car'),
year: z.number().int().nullable().optional()
});
export const CarUpdatePayloadSchema = z.object({
brand: z.string().optional(),
color: z.string().nullable().optional(),
doors: z.number().int().nullable().optional(),
model: z.string().optional(),
type: z.literal('car').optional(),
year: z.number().int().nullable().optional()
});
export const IntegerFilterBetweenSchema = z.object({
from: z.number().int().optional(),
to: z.number().int().optional()
});
export const IssueSchema = z.object({
code: z.string(),
detail: z.string(),
meta: z.record(z.string(), z.unknown()),
path: z.array(z.string()),
pointer: z.string()
});
export const MotorcycleSchema = z.object({
brand: z.string(),
color: z.string().nullable(),
createdAt: z.iso.datetime(),
engineCc: z.number().int().nullable(),
id: z.string(),
model: z.string(),
type: z.string(),
updatedAt: z.iso.datetime(),
year: z.number().int().nullable()
});
export const MotorcycleCreatePayloadSchema = z.object({
brand: z.string(),
color: z.string().nullable().optional(),
engineCc: z.number().int().nullable().optional(),
model: z.string(),
type: z.literal('motorcycle'),
year: z.number().int().nullable().optional()
});
export const MotorcycleUpdatePayloadSchema = z.object({
brand: z.string().optional(),
color: z.string().nullable().optional(),
engineCc: z.number().int().nullable().optional(),
model: z.string().optional(),
type: z.literal('motorcycle').optional(),
year: z.number().int().nullable().optional()
});
export const OffsetPaginationSchema = z.object({
current: z.number().int(),
items: z.number().int(),
next: z.number().int().nullable().optional(),
prev: z.number().int().nullable().optional(),
total: z.number().int()
});
export const StringFilterSchema = z.object({
contains: z.string().optional(),
endsWith: z.string().optional(),
eq: z.string().optional(),
in: z.array(z.string()).optional(),
startsWith: z.string().optional()
});
export const TruckSchema = z.object({
brand: z.string(),
color: z.string().nullable(),
createdAt: z.iso.datetime(),
id: z.string(),
model: z.string(),
payloadCapacity: z.number().nullable(),
type: z.string(),
updatedAt: z.iso.datetime(),
year: z.number().int().nullable()
});
export const TruckCreatePayloadSchema = z.object({
brand: z.string(),
color: z.string().nullable().optional(),
model: z.string(),
payloadCapacity: z.number().nullable().optional(),
type: z.literal('truck'),
year: z.number().int().nullable().optional()
});
export const TruckUpdatePayloadSchema = z.object({
brand: z.string().optional(),
color: z.string().nullable().optional(),
model: z.string().optional(),
payloadCapacity: z.number().nullable().optional(),
type: z.literal('truck').optional(),
year: z.number().int().nullable().optional()
});
export const VehiclePageSchema = z.object({
number: z.number().int().min(1).optional(),
size: z.number().int().min(1).max(100).optional()
});
export const VehicleSortSchema = z.object({
year: SortDirectionSchema.optional()
});
export const VehicleTypeFilterSchema = z.union([
VehicleTypeSchema,
z.object({ eq: VehicleTypeSchema, in: z.array(VehicleTypeSchema) }).partial()
]);
export const ErrorSchema = z.object({
issues: z.array(IssueSchema),
layer: LayerSchema
});
export const NullableIntegerFilterSchema = z.object({
between: IntegerFilterBetweenSchema.optional(),
eq: z.number().int().optional(),
gt: z.number().int().optional(),
gte: z.number().int().optional(),
in: z.array(z.number().int()).optional(),
lt: z.number().int().optional(),
lte: z.number().int().optional(),
null: z.boolean().optional()
});
export const VehicleSchema = z.discriminatedUnion('type', [
CarSchema,
MotorcycleSchema,
TruckSchema
]);
export const ErrorResponseBodySchema = ErrorSchema;
export const VehicleCreateSuccessResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
vehicle: VehicleSchema
});
export const VehicleIndexSuccessResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
pagination: OffsetPaginationSchema,
vehicles: z.array(VehicleSchema)
});
export const VehicleShowSuccessResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
vehicle: VehicleSchema
});
export const VehicleUpdateSuccessResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
vehicle: VehicleSchema
});
export const VehiclesIndexRequestQuerySchema = z.object({
filter: z.union([VehicleFilterSchema, z.array(VehicleFilterSchema)]).optional(),
page: VehiclePageSchema.optional(),
sort: z.union([VehicleSortSchema, z.array(VehicleSortSchema)]).optional()
});
export const VehiclesIndexRequestSchema = z.object({
query: VehiclesIndexRequestQuerySchema
});
export const VehiclesIndexResponseBodySchema = z.union([VehicleIndexSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const VehiclesIndexResponseSchema = z.object({
body: VehiclesIndexResponseBodySchema
});
export const VehiclesShowResponseBodySchema = z.union([VehicleShowSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const VehiclesShowResponseSchema = z.object({
body: VehiclesShowResponseBodySchema
});
export const VehiclesCreateRequestBodySchema = z.object({
vehicle: z.discriminatedUnion('type', [CarCreatePayloadSchema, MotorcycleCreatePayloadSchema, TruckCreatePayloadSchema])
});
export const VehiclesCreateRequestSchema = z.object({
body: VehiclesCreateRequestBodySchema
});
export const VehiclesCreateResponseBodySchema = z.union([VehicleCreateSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const VehiclesCreateResponseSchema = z.object({
body: VehiclesCreateResponseBodySchema
});
export const VehiclesUpdateRequestBodySchema = z.object({
vehicle: z.discriminatedUnion('type', [CarUpdatePayloadSchema, MotorcycleUpdatePayloadSchema, TruckUpdatePayloadSchema])
});
export const VehiclesUpdateRequestSchema = z.object({
body: VehiclesUpdateRequestBodySchema
});
export const VehiclesUpdateResponseBodySchema = z.union([VehicleUpdateSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const VehiclesUpdateResponseSchema = z.object({
body: VehiclesUpdateResponseBodySchema
});
export const VehiclesDestroyResponseSchema = z.never();
export interface Car {
brand: string;
color: null | string;
createdAt: string;
doors: null | number;
id: string;
model: string;
type: string;
updatedAt: string;
year: null | number;
}
export interface CarCreatePayload {
brand: string;
color?: null | string;
doors?: null | number;
model: string;
type: 'car';
year?: null | number;
}
export interface CarUpdatePayload {
brand?: string;
color?: null | string;
doors?: null | number;
model?: string;
type?: 'car';
year?: null | number;
}
export interface Error {
issues: Issue[];
layer: Layer;
}
export type ErrorResponseBody = Error;
export interface IntegerFilterBetween {
from?: number;
to?: number;
}
export interface Issue {
code: string;
detail: string;
meta: Record<string, unknown>;
path: string[];
pointer: string;
}
export type Layer = 'contract' | 'domain' | 'http';
export interface Motorcycle {
brand: string;
color: null | string;
createdAt: string;
engineCc: null | number;
id: string;
model: string;
type: string;
updatedAt: string;
year: null | number;
}
export interface MotorcycleCreatePayload {
brand: string;
color?: null | string;
engineCc?: null | number;
model: string;
type: 'motorcycle';
year?: null | number;
}
export interface MotorcycleUpdatePayload {
brand?: string;
color?: null | string;
engineCc?: null | number;
model?: string;
type?: 'motorcycle';
year?: null | number;
}
export interface NullableIntegerFilter {
between?: IntegerFilterBetween;
eq?: number;
gt?: number;
gte?: number;
in?: number[];
lt?: number;
lte?: number;
null?: boolean;
}
export interface OffsetPagination {
current: number;
items: number;
next?: null | number;
prev?: null | number;
total: number;
}
export type SortDirection = 'asc' | 'desc';
export interface StringFilter {
contains?: string;
endsWith?: string;
eq?: string;
in?: string[];
startsWith?: string;
}
export interface Truck {
brand: string;
color: null | string;
createdAt: string;
id: string;
model: string;
payloadCapacity: null | number;
type: string;
updatedAt: string;
year: null | number;
}
export interface TruckCreatePayload {
brand: string;
color?: null | string;
model: string;
payloadCapacity?: null | number;
type: 'truck';
year?: null | number;
}
export interface TruckUpdatePayload {
brand?: string;
color?: null | string;
model?: string;
payloadCapacity?: null | number;
type?: 'truck';
year?: null | number;
}
export type Vehicle = Car | Motorcycle | Truck;
export interface VehicleCreateSuccessResponseBody {
meta?: Record<string, unknown>;
vehicle: Vehicle;
}
export interface VehicleFilter {
AND?: VehicleFilter[];
NOT?: VehicleFilter;
OR?: VehicleFilter[];
brand?: StringFilter | string;
model?: StringFilter | string;
type?: VehicleTypeFilter;
year?: NullableIntegerFilter | number;
}
export interface VehicleIndexSuccessResponseBody {
meta?: Record<string, unknown>;
pagination: OffsetPagination;
vehicles: Vehicle[];
}
export interface VehiclePage {
number?: number;
size?: number;
}
export interface VehicleShowSuccessResponseBody {
meta?: Record<string, unknown>;
vehicle: Vehicle;
}
export interface VehicleSort {
year?: SortDirection;
}
export type VehicleType = 'car' | 'motorcycle' | 'truck';
export type VehicleTypeFilter = VehicleType | { eq?: VehicleType; in?: VehicleType[] };
export interface VehicleUpdateSuccessResponseBody {
meta?: Record<string, unknown>;
vehicle: Vehicle;
}
export interface VehiclesCreateRequest {
body: VehiclesCreateRequestBody;
}
export interface VehiclesCreateRequestBody {
vehicle: CarCreatePayload | MotorcycleCreatePayload | TruckCreatePayload;
}
export interface VehiclesCreateResponse {
body: VehiclesCreateResponseBody;
}
export type VehiclesCreateResponseBody = ErrorResponseBody | VehicleCreateSuccessResponseBody;
export type VehiclesDestroyResponse = never;
export interface VehiclesIndexRequest {
query: VehiclesIndexRequestQuery;
}
export interface VehiclesIndexRequestQuery {
filter?: VehicleFilter | VehicleFilter[];
page?: VehiclePage;
sort?: VehicleSort | VehicleSort[];
}
export interface VehiclesIndexResponse {
body: VehiclesIndexResponseBody;
}
export type VehiclesIndexResponseBody = ErrorResponseBody | VehicleIndexSuccessResponseBody;
export interface VehiclesShowResponse {
body: VehiclesShowResponseBody;
}
export type VehiclesShowResponseBody = ErrorResponseBody | VehicleShowSuccessResponseBody;
export interface VehiclesUpdateRequest {
body: VehiclesUpdateRequestBody;
}
export interface VehiclesUpdateRequestBody {
vehicle: CarUpdatePayload | MotorcycleUpdatePayload | TruckUpdatePayload;
}
export interface VehiclesUpdateResponse {
body: VehiclesUpdateResponseBody;
}
export type VehiclesUpdateResponseBody = ErrorResponseBody | VehicleUpdateSuccessResponseBody;OpenAPI
yml
---
openapi: 3.1.0
info:
title: "/mighty_wolf"
version: 1.0.0
paths:
"/vehicles":
get:
operationId: vehiclesIndex
parameters:
- in: query
name: filter
required: false
schema:
oneOf:
- "$ref": "#/components/schemas/vehicleFilter"
- items:
"$ref": "#/components/schemas/vehicleFilter"
type: array
- in: query
name: page
required: false
schema:
"$ref": "#/components/schemas/vehiclePage"
- in: query
name: sort
required: false
schema:
oneOf:
- "$ref": "#/components/schemas/vehicleSort"
- items:
"$ref": "#/components/schemas/vehicleSort"
type: array
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/vehicleIndexSuccessResponseBody"
description: Successful response
post:
operationId: vehiclesCreate
requestBody:
content:
application/json:
schema:
properties:
vehicle:
oneOf:
- "$ref": "#/components/schemas/carCreatePayload"
- "$ref": "#/components/schemas/motorcycleCreatePayload"
- "$ref": "#/components/schemas/truckCreatePayload"
discriminator:
mapping:
car: "#/components/schemas/carCreatePayload"
motorcycle: "#/components/schemas/motorcycleCreatePayload"
truck: "#/components/schemas/truckCreatePayload"
propertyName: type
type: object
required:
- vehicle
required: true
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/vehicleCreateSuccessResponseBody"
description: Successful response
'422':
description: Unprocessable Entity
content:
application/json:
schema:
"$ref": "#/components/schemas/errorResponseBody"
"/vehicles/{id}":
get:
operationId: vehiclesShow
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/vehicleShowSuccessResponseBody"
description: Successful response
patch:
operationId: vehiclesUpdate
parameters:
- in: path
name: id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
vehicle:
oneOf:
- "$ref": "#/components/schemas/carUpdatePayload"
- "$ref": "#/components/schemas/motorcycleUpdatePayload"
- "$ref": "#/components/schemas/truckUpdatePayload"
discriminator:
mapping:
car: "#/components/schemas/carUpdatePayload"
motorcycle: "#/components/schemas/motorcycleUpdatePayload"
truck: "#/components/schemas/truckUpdatePayload"
propertyName: type
type: object
required:
- vehicle
required: true
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/vehicleUpdateSuccessResponseBody"
description: Successful response
'422':
description: Unprocessable Entity
content:
application/json:
schema:
"$ref": "#/components/schemas/errorResponseBody"
delete:
operationId: vehiclesDestroy
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'204':
description: No content
components:
schemas:
car:
properties:
brand:
type: string
color:
type:
- string
- 'null'
createdAt:
type: string
format: date-time
doors:
type:
- integer
- 'null'
id:
type: string
model:
type: string
type:
type: string
updatedAt:
type: string
format: date-time
year:
type:
- integer
- 'null'
type: object
required:
- brand
- color
- createdAt
- doors
- id
- model
- type
- updatedAt
- year
carCreatePayload:
properties:
brand:
type: string
color:
type:
- string
- 'null'
doors:
type:
- integer
- 'null'
model:
type: string
type:
const: car
type: string
year:
type:
- integer
- 'null'
type: object
required:
- brand
- model
- type
carUpdatePayload:
properties:
brand:
type: string
color:
type:
- string
- 'null'
doors:
type:
- integer
- 'null'
model:
type: string
type:
const: car
type: string
year:
type:
- integer
- 'null'
type: object
error:
properties:
issues:
items:
"$ref": "#/components/schemas/issue"
type: array
layer:
enum:
- http
- contract
- domain
type: string
type: object
required:
- issues
- layer
errorResponseBody:
"$ref": "#/components/schemas/error"
integerFilterBetween:
properties:
from:
type: integer
to:
type: integer
type: object
issue:
properties:
code:
type: string
detail:
type: string
meta:
properties: {}
type: object
path:
items:
type: string
type: array
pointer:
type: string
type: object
required:
- code
- detail
- meta
- path
- pointer
motorcycle:
properties:
brand:
type: string
color:
type:
- string
- 'null'
createdAt:
type: string
format: date-time
engineCc:
type:
- integer
- 'null'
id:
type: string
model:
type: string
type:
type: string
updatedAt:
type: string
format: date-time
year:
type:
- integer
- 'null'
type: object
required:
- brand
- color
- createdAt
- engineCc
- id
- model
- type
- updatedAt
- year
motorcycleCreatePayload:
properties:
brand:
type: string
color:
type:
- string
- 'null'
engineCc:
type:
- integer
- 'null'
model:
type: string
type:
const: motorcycle
type: string
year:
type:
- integer
- 'null'
type: object
required:
- brand
- model
- type
motorcycleUpdatePayload:
properties:
brand:
type: string
color:
type:
- string
- 'null'
engineCc:
type:
- integer
- 'null'
model:
type: string
type:
const: motorcycle
type: string
year:
type:
- integer
- 'null'
type: object
nullableIntegerFilter:
properties:
between:
"$ref": "#/components/schemas/integerFilterBetween"
eq:
type: integer
gt:
type: integer
gte:
type: integer
in:
items:
type: integer
type: array
lt:
type: integer
lte:
type: integer
'null':
type: boolean
type: object
offsetPagination:
properties:
current:
type: integer
items:
type: integer
next:
type:
- integer
- 'null'
prev:
type:
- integer
- 'null'
total:
type: integer
type: object
required:
- current
- items
- total
stringFilter:
properties:
contains:
type: string
endsWith:
type: string
eq:
type: string
in:
items:
type: string
type: array
startsWith:
type: string
type: object
truck:
properties:
brand:
type: string
color:
type:
- string
- 'null'
createdAt:
type: string
format: date-time
id:
type: string
model:
type: string
payloadCapacity:
type:
- number
- 'null'
type:
type: string
updatedAt:
type: string
format: date-time
year:
type:
- integer
- 'null'
type: object
required:
- brand
- color
- createdAt
- id
- model
- payloadCapacity
- type
- updatedAt
- year
truckCreatePayload:
properties:
brand:
type: string
color:
type:
- string
- 'null'
model:
type: string
payloadCapacity:
type:
- number
- 'null'
type:
const: truck
type: string
year:
type:
- integer
- 'null'
type: object
required:
- brand
- model
- type
truckUpdatePayload:
properties:
brand:
type: string
color:
type:
- string
- 'null'
model:
type: string
payloadCapacity:
type:
- number
- 'null'
type:
const: truck
type: string
year:
type:
- integer
- 'null'
type: object
vehicle:
oneOf:
- "$ref": "#/components/schemas/car"
- "$ref": "#/components/schemas/motorcycle"
- "$ref": "#/components/schemas/truck"
discriminator:
mapping:
car: "#/components/schemas/car"
motorcycle: "#/components/schemas/motorcycle"
truck: "#/components/schemas/truck"
propertyName: type
vehicleCreateSuccessResponseBody:
properties:
meta:
properties: {}
type: object
vehicle:
"$ref": "#/components/schemas/vehicle"
type: object
required:
- vehicle
vehicleFilter:
properties:
AND:
items:
"$ref": "#/components/schemas/vehicleFilter"
type: array
NOT:
"$ref": "#/components/schemas/vehicleFilter"
OR:
items:
"$ref": "#/components/schemas/vehicleFilter"
type: array
brand:
oneOf:
- type: string
- "$ref": "#/components/schemas/stringFilter"
model:
oneOf:
- type: string
- "$ref": "#/components/schemas/stringFilter"
type:
"$ref": "#/components/schemas/vehicleTypeFilter"
year:
oneOf:
- type: integer
- "$ref": "#/components/schemas/nullableIntegerFilter"
type: object
vehicleIndexSuccessResponseBody:
properties:
pagination:
"$ref": "#/components/schemas/offsetPagination"
meta:
properties: {}
type: object
vehicles:
items:
"$ref": "#/components/schemas/vehicle"
type: array
type: object
required:
- pagination
- vehicles
vehiclePage:
properties:
number:
type: integer
minimum: 1
size:
type: integer
minimum: 1
maximum: 100
type: object
vehicleShowSuccessResponseBody:
properties:
meta:
properties: {}
type: object
vehicle:
"$ref": "#/components/schemas/vehicle"
type: object
required:
- vehicle
vehicleSort:
properties:
year:
enum:
- asc
- desc
type: string
type: object
vehicleTypeFilter:
oneOf:
- enum:
- car
- motorcycle
- truck
type: string
- properties:
eq:
enum:
- car
- motorcycle
- truck
type: string
in:
items:
enum:
- car
- motorcycle
- truck
type: string
type: array
type: object
required:
- eq
- in
vehicleUpdateSuccessResponseBody:
properties:
meta:
properties: {}
type: object
vehicle:
"$ref": "#/components/schemas/vehicle"
type: object
required:
- vehicle