Representations
Generate a complete contract from representation definitions
API Definition
config/apis/eager_lion.rb
rb
# frozen_string_literal: true
Apiwork::API.define '/eager_lion' do
key_format :camel
export :openapi
export :typescript
export :zod
resources :invoices
endModels
app/models/eager_lion/invoice.rb
rb
# frozen_string_literal: true
module EagerLion
class Invoice < ApplicationRecord
belongs_to :customer
has_many :lines, dependent: :destroy
enum :status, { draft: 0, sent: 1, paid: 2 }
validates :number, presence: true
end
endDatabase Table
| Column | Type | Nullable | Default |
|---|---|---|---|
| id | string | ||
| created_at | datetime | ||
| customer_id | string | ||
| issued_on | date | ✓ | |
| notes | string | ✓ | |
| number | string | ||
| status | integer | 0 | |
| updated_at | datetime |
app/models/eager_lion/customer.rb
rb
# frozen_string_literal: true
module EagerLion
class Customer < ApplicationRecord
has_many :invoices, dependent: :destroy
end
endDatabase Table
| Column | Type | Nullable | Default |
|---|---|---|---|
| id | string | ||
| created_at | datetime | ||
| name | string | ||
| updated_at | datetime |
app/models/eager_lion/line.rb
rb
# frozen_string_literal: true
module EagerLion
class Line < ApplicationRecord
belongs_to :invoice
end
endDatabase Table
| Column | Type | Nullable | Default |
|---|---|---|---|
| id | string | ||
| created_at | datetime | ||
| description | string | ✓ | |
| invoice_id | string | ||
| price | decimal | ✓ | |
| quantity | integer | ✓ | |
| updated_at | datetime |
Representations
app/representations/eager_lion/invoice_representation.rb
rb
# frozen_string_literal: true
module EagerLion
class InvoiceRepresentation < Apiwork::Representation::Base
attribute :id
attribute :number, filterable: true, writable: true
attribute :issued_on, sortable: true, writable: true
attribute :notes, writable: true
attribute :status, filterable: true, sortable: true, writable: true
attribute :customer_id, writable: true
attribute :created_at, sortable: true
attribute :updated_at, sortable: true
has_many :lines, include: :always
belongs_to :customer, include: :always
end
endapp/representations/eager_lion/customer_representation.rb
rb
# frozen_string_literal: true
module EagerLion
class CustomerRepresentation < Apiwork::Representation::Base
attribute :id
attribute :name
end
endapp/representations/eager_lion/line_representation.rb
rb
# frozen_string_literal: true
module EagerLion
class LineRepresentation < Apiwork::Representation::Base
attribute :id
attribute :description, writable: true
attribute :quantity, writable: true
attribute :price, writable: true
end
endContracts
app/contracts/eager_lion/invoice_contract.rb
rb
# frozen_string_literal: true
module EagerLion
class InvoiceContract < Apiwork::Contract::Base
representation InvoiceRepresentation
end
endControllers
app/controllers/eager_lion/invoices_controller.rb
rb
# frozen_string_literal: true
module EagerLion
class InvoicesController < ApplicationController
before_action :set_invoice, only: %i[show update destroy]
def index
invoices = Invoice.all
expose invoices
end
def show
expose invoice
end
def create
invoice = Invoice.create(contract.body[:invoice])
expose invoice
end
def update
invoice.update(contract.body[:invoice])
expose invoice
end
def destroy
invoice.destroy
expose invoice
end
private
attr_reader :invoice
def set_invoice
@invoice = Invoice.find(params[:id])
end
end
endRequest Examples
List all invoices
Request
http
GET /eager_lion/invoicesResponse 200
json
{
"invoices": [
{
"id": "534ec78b-1e57-5f61-ae31-cd61470deb95",
"number": "INV-001",
"issuedOn": null,
"notes": null,
"status": "sent",
"customerId": "9428d849-05a5-5c52-a90a-906eac07ecd2",
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"lines": [],
"customer": {
"id": "9428d849-05a5-5c52-a90a-906eac07ecd2",
"name": "Acme Corp"
}
},
{
"id": "beeed37c-a296-52da-9206-364418ea6f8e",
"number": "INV-002",
"issuedOn": null,
"notes": null,
"status": "draft",
"customerId": "9428d849-05a5-5c52-a90a-906eac07ecd2",
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"lines": [],
"customer": {
"id": "9428d849-05a5-5c52-a90a-906eac07ecd2",
"name": "Acme Corp"
}
}
],
"pagination": {
"items": 2,
"total": 1,
"current": 1,
"next": null,
"prev": null
}
}Get invoice details
Request
http
GET /eager_lion/invoices/534ec78b-1e57-5f61-ae31-cd61470deb95Response 200
json
{
"invoice": {
"id": "534ec78b-1e57-5f61-ae31-cd61470deb95",
"number": "INV-001",
"issuedOn": null,
"notes": null,
"status": "sent",
"customerId": "9428d849-05a5-5c52-a90a-906eac07ecd2",
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"lines": [],
"customer": {
"id": "9428d849-05a5-5c52-a90a-906eac07ecd2",
"name": "Acme Corp"
}
}
}Create a new invoice
Request
http
POST /eager_lion/invoices
Content-Type: application/json
{
"invoice": {
"number": "INV-001",
"status": "sent",
"customerId": "9428d849-05a5-5c52-a90a-906eac07ecd2",
"issuedOn": "2024-01-15",
"notes": "First invoice"
}
}Response 201
json
{
"invoice": {
"id": "534ec78b-1e57-5f61-ae31-cd61470deb95",
"number": "INV-001",
"issuedOn": "2024-01-15",
"notes": "First invoice",
"status": "sent",
"customerId": "9428d849-05a5-5c52-a90a-906eac07ecd2",
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"lines": [],
"customer": {
"id": "9428d849-05a5-5c52-a90a-906eac07ecd2",
"name": "Acme Corp"
}
}
}Update an invoice
Request
http
PATCH /eager_lion/invoices/534ec78b-1e57-5f61-ae31-cd61470deb95
Content-Type: application/json
{
"invoice": {
"status": "sent",
"notes": "Updated notes"
}
}Response 200
json
{
"invoice": {
"id": "534ec78b-1e57-5f61-ae31-cd61470deb95",
"number": "INV-001",
"issuedOn": null,
"notes": "Updated notes",
"status": "sent",
"customerId": "9428d849-05a5-5c52-a90a-906eac07ecd2",
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z",
"lines": [],
"customer": {
"id": "9428d849-05a5-5c52-a90a-906eac07ecd2",
"name": "Acme Corp"
}
}
}Delete an invoice
Request
http
DELETE /eager_lion/invoices/534ec78b-1e57-5f61-ae31-cd61470deb95Response 204
Generated Output
Introspection
json
{
"base_path": "/eager_lion",
"enums": {
"invoice_status": {
"deprecated": false,
"description": null,
"example": null,
"values": [
"draft",
"sent",
"paid"
]
},
"layer": {
"deprecated": false,
"description": null,
"example": null,
"values": [
"http",
"contract",
"domain"
]
},
"sort_direction": {
"deprecated": false,
"description": null,
"example": null,
"values": [
"asc",
"desc"
]
}
},
"error_codes": {
"unprocessable_entity": {
"description": "Unprocessable Entity",
"status": 422
}
},
"info": null,
"resources": {
"invoices": {
"actions": {
"index": {
"deprecated": false,
"description": null,
"method": "get",
"operation_id": null,
"path": "/invoices",
"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": "invoice_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": "invoice_filter"
},
"shape": {}
}
]
},
"page": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "invoice_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": "invoice_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": "invoice_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": "invoice_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": "/invoices/: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": "invoice_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": "/invoices",
"raises": [
"unprocessable_entity"
],
"request": {
"body": {
"invoice": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "invoice_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": "invoice_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": "/invoices/:id",
"raises": [
"unprocessable_entity"
],
"request": {
"body": {
"invoice": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "invoice_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": "invoice_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": "/invoices/: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": "invoices",
"parent_identifiers": [],
"path": "invoices",
"resources": {}
}
},
"types": {
"customer": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"id": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"name": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"customer_create_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {},
"type": "object",
"variants": []
},
"customer_update_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {},
"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": []
},
"invoice": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"created_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
},
"customer": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "customer"
},
"customer_id": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"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
},
"issued_on": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "date"
},
"lines": {
"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": "line"
},
"shape": {}
},
"notes": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"number": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"status": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"enum": "invoice_status",
"format": null,
"max": null,
"min": null
},
"updated_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
}
},
"type": "object",
"variants": []
},
"invoice_create_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"customer_id": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"issued_on": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "date"
},
"notes": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"number": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"status": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"enum": "invoice_status",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"invoice_create_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"invoice": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "invoice"
},
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
}
},
"type": "object",
"variants": []
},
"invoice_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": "invoice_filter"
},
"shape": {}
},
"NOT": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "invoice_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": "invoice_filter"
},
"shape": {}
},
"number": {
"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"
}
]
},
"status": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "invoice_status_filter"
}
},
"type": "object",
"variants": []
},
"invoice_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"
},
"invoices": {
"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": "invoice"
},
"shape": {}
},
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
}
},
"type": "object",
"variants": []
},
"invoice_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": []
},
"invoice_show_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"invoice": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "invoice"
},
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
}
},
"type": "object",
"variants": []
},
"invoice_sort": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"created_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
},
"issued_on": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
},
"status": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
},
"updated_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
}
},
"type": "object",
"variants": []
},
"invoice_status_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": "invoice_status"
},
{
"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": "invoice_status"
},
"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": "invoice_status"
},
"shape": {}
}
}
}
]
},
"invoice_update_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"customer_id": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"issued_on": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "date"
},
"notes": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"number": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"status": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"enum": "invoice_status",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"invoice_update_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"invoice": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "invoice"
},
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
}
},
"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": []
},
"line": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"description": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "string",
"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
},
"price": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "decimal",
"max": null,
"min": null
},
"quantity": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"line_create_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"description": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"price": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "decimal",
"max": null,
"min": null
},
"quantity": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"line_update_payload": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"description": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"price": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "decimal",
"max": null,
"min": null
},
"quantity": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"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": []
}
}
}TypeScript
ts
export interface Customer {
id: string;
name: string;
}
export interface Error {
issues: Issue[];
layer: Layer;
}
export type ErrorResponseBody = Error;
export interface Invoice {
createdAt: string;
customer: Customer;
customerId: string;
id: string;
issuedOn: null | string;
lines: Line[];
notes: null | string;
number: string;
status: InvoiceStatus;
updatedAt: string;
}
export interface InvoiceCreatePayload {
customerId: string;
issuedOn?: null | string;
notes?: null | string;
number: string;
status?: InvoiceStatus;
}
export interface InvoiceCreateSuccessResponseBody {
invoice: Invoice;
meta?: Record<string, unknown>;
}
export interface InvoiceFilter {
AND?: InvoiceFilter[];
NOT?: InvoiceFilter;
OR?: InvoiceFilter[];
number?: StringFilter | string;
status?: InvoiceStatusFilter;
}
export interface InvoiceIndexSuccessResponseBody {
invoices: Invoice[];
meta?: Record<string, unknown>;
pagination: OffsetPagination;
}
export interface InvoicePage {
number?: number;
size?: number;
}
export interface InvoiceShowSuccessResponseBody {
invoice: Invoice;
meta?: Record<string, unknown>;
}
export interface InvoiceSort {
createdAt?: SortDirection;
issuedOn?: SortDirection;
status?: SortDirection;
updatedAt?: SortDirection;
}
export type InvoiceStatus = 'draft' | 'paid' | 'sent';
export type InvoiceStatusFilter = InvoiceStatus | { eq?: InvoiceStatus; in?: InvoiceStatus[] };
export interface InvoiceUpdatePayload {
customerId?: string;
issuedOn?: null | string;
notes?: null | string;
number?: string;
status?: InvoiceStatus;
}
export interface InvoiceUpdateSuccessResponseBody {
invoice: Invoice;
meta?: Record<string, unknown>;
}
export interface InvoicesCreateRequest {
body: InvoicesCreateRequestBody;
}
export interface InvoicesCreateRequestBody {
invoice: InvoiceCreatePayload;
}
export interface InvoicesCreateResponse {
body: InvoicesCreateResponseBody;
}
export type InvoicesCreateResponseBody = ErrorResponseBody | InvoiceCreateSuccessResponseBody;
export type InvoicesDestroyResponse = never;
export interface InvoicesIndexRequest {
query: InvoicesIndexRequestQuery;
}
export interface InvoicesIndexRequestQuery {
filter?: InvoiceFilter | InvoiceFilter[];
page?: InvoicePage;
sort?: InvoiceSort | InvoiceSort[];
}
export interface InvoicesIndexResponse {
body: InvoicesIndexResponseBody;
}
export type InvoicesIndexResponseBody = ErrorResponseBody | InvoiceIndexSuccessResponseBody;
export interface InvoicesShowResponse {
body: InvoicesShowResponseBody;
}
export type InvoicesShowResponseBody = ErrorResponseBody | InvoiceShowSuccessResponseBody;
export interface InvoicesUpdateRequest {
body: InvoicesUpdateRequestBody;
}
export interface InvoicesUpdateRequestBody {
invoice: InvoiceUpdatePayload;
}
export interface InvoicesUpdateResponse {
body: InvoicesUpdateResponseBody;
}
export type InvoicesUpdateResponseBody = ErrorResponseBody | InvoiceUpdateSuccessResponseBody;
export interface Issue {
code: string;
detail: string;
meta: Record<string, unknown>;
path: string[];
pointer: string;
}
export type Layer = 'contract' | 'domain' | 'http';
export interface Line {
description: null | string;
id: string;
price: null | number;
quantity: null | number;
}
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;
}Zod
ts
import { z } from 'zod';
export const InvoiceStatusSchema = z.enum(['draft', 'paid', 'sent']);
export const LayerSchema = z.enum(['contract', 'domain', 'http']);
export const SortDirectionSchema = z.enum(['asc', 'desc']);
export const InvoiceFilterSchema: z.ZodType<InvoiceFilter> = z.lazy(() => z.object({
AND: z.array(InvoiceFilterSchema).optional(),
NOT: InvoiceFilterSchema.optional(),
OR: z.array(InvoiceFilterSchema).optional(),
number: z.union([z.string(), StringFilterSchema]).optional(),
status: InvoiceStatusFilterSchema.optional()
}));
export const CustomerSchema = z.object({
id: z.string(),
name: z.string()
});
export const InvoiceCreatePayloadSchema = z.object({
customerId: z.string(),
issuedOn: z.iso.date().nullable().optional(),
notes: z.string().nullable().optional(),
number: z.string(),
status: InvoiceStatusSchema.optional()
});
export const InvoicePageSchema = z.object({
number: z.number().int().min(1).optional(),
size: z.number().int().min(1).max(100).optional()
});
export const InvoiceSortSchema = z.object({
createdAt: SortDirectionSchema.optional(),
issuedOn: SortDirectionSchema.optional(),
status: SortDirectionSchema.optional(),
updatedAt: SortDirectionSchema.optional()
});
export const InvoiceStatusFilterSchema = z.union([
InvoiceStatusSchema,
z.object({ eq: InvoiceStatusSchema, in: z.array(InvoiceStatusSchema) }).partial()
]);
export const InvoiceUpdatePayloadSchema = z.object({
customerId: z.string().optional(),
issuedOn: z.iso.date().nullable().optional(),
notes: z.string().nullable().optional(),
number: z.string().optional(),
status: InvoiceStatusSchema.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 LineSchema = z.object({
description: z.string().nullable(),
id: z.string(),
price: z.number().nullable(),
quantity: z.number().int().nullable()
});
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 ErrorSchema = z.object({
issues: z.array(IssueSchema),
layer: LayerSchema
});
export const InvoiceSchema = z.object({
createdAt: z.iso.datetime(),
customer: CustomerSchema,
customerId: z.string(),
id: z.string(),
issuedOn: z.iso.date().nullable(),
lines: z.array(LineSchema),
notes: z.string().nullable(),
number: z.string(),
status: InvoiceStatusSchema,
updatedAt: z.iso.datetime()
});
export const ErrorResponseBodySchema = ErrorSchema;
export const InvoiceCreateSuccessResponseBodySchema = z.object({
invoice: InvoiceSchema,
meta: z.record(z.string(), z.unknown()).optional()
});
export const InvoiceIndexSuccessResponseBodySchema = z.object({
invoices: z.array(InvoiceSchema),
meta: z.record(z.string(), z.unknown()).optional(),
pagination: OffsetPaginationSchema
});
export const InvoiceShowSuccessResponseBodySchema = z.object({
invoice: InvoiceSchema,
meta: z.record(z.string(), z.unknown()).optional()
});
export const InvoiceUpdateSuccessResponseBodySchema = z.object({
invoice: InvoiceSchema,
meta: z.record(z.string(), z.unknown()).optional()
});
export const InvoicesIndexRequestQuerySchema = z.object({
filter: z.union([InvoiceFilterSchema, z.array(InvoiceFilterSchema)]).optional(),
page: InvoicePageSchema.optional(),
sort: z.union([InvoiceSortSchema, z.array(InvoiceSortSchema)]).optional()
});
export const InvoicesIndexRequestSchema = z.object({
query: InvoicesIndexRequestQuerySchema
});
export const InvoicesIndexResponseBodySchema = z.union([InvoiceIndexSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const InvoicesIndexResponseSchema = z.object({
body: InvoicesIndexResponseBodySchema
});
export const InvoicesShowResponseBodySchema = z.union([InvoiceShowSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const InvoicesShowResponseSchema = z.object({
body: InvoicesShowResponseBodySchema
});
export const InvoicesCreateRequestBodySchema = z.object({
invoice: InvoiceCreatePayloadSchema
});
export const InvoicesCreateRequestSchema = z.object({
body: InvoicesCreateRequestBodySchema
});
export const InvoicesCreateResponseBodySchema = z.union([InvoiceCreateSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const InvoicesCreateResponseSchema = z.object({
body: InvoicesCreateResponseBodySchema
});
export const InvoicesUpdateRequestBodySchema = z.object({
invoice: InvoiceUpdatePayloadSchema
});
export const InvoicesUpdateRequestSchema = z.object({
body: InvoicesUpdateRequestBodySchema
});
export const InvoicesUpdateResponseBodySchema = z.union([InvoiceUpdateSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const InvoicesUpdateResponseSchema = z.object({
body: InvoicesUpdateResponseBodySchema
});
export const InvoicesDestroyResponseSchema = z.never();
export interface Customer {
id: string;
name: string;
}
export interface Error {
issues: Issue[];
layer: Layer;
}
export type ErrorResponseBody = Error;
export interface Invoice {
createdAt: string;
customer: Customer;
customerId: string;
id: string;
issuedOn: null | string;
lines: Line[];
notes: null | string;
number: string;
status: InvoiceStatus;
updatedAt: string;
}
export interface InvoiceCreatePayload {
customerId: string;
issuedOn?: null | string;
notes?: null | string;
number: string;
status?: InvoiceStatus;
}
export interface InvoiceCreateSuccessResponseBody {
invoice: Invoice;
meta?: Record<string, unknown>;
}
export interface InvoiceFilter {
AND?: InvoiceFilter[];
NOT?: InvoiceFilter;
OR?: InvoiceFilter[];
number?: StringFilter | string;
status?: InvoiceStatusFilter;
}
export interface InvoiceIndexSuccessResponseBody {
invoices: Invoice[];
meta?: Record<string, unknown>;
pagination: OffsetPagination;
}
export interface InvoicePage {
number?: number;
size?: number;
}
export interface InvoiceShowSuccessResponseBody {
invoice: Invoice;
meta?: Record<string, unknown>;
}
export interface InvoiceSort {
createdAt?: SortDirection;
issuedOn?: SortDirection;
status?: SortDirection;
updatedAt?: SortDirection;
}
export type InvoiceStatus = 'draft' | 'paid' | 'sent';
export type InvoiceStatusFilter = InvoiceStatus | { eq?: InvoiceStatus; in?: InvoiceStatus[] };
export interface InvoiceUpdatePayload {
customerId?: string;
issuedOn?: null | string;
notes?: null | string;
number?: string;
status?: InvoiceStatus;
}
export interface InvoiceUpdateSuccessResponseBody {
invoice: Invoice;
meta?: Record<string, unknown>;
}
export interface InvoicesCreateRequest {
body: InvoicesCreateRequestBody;
}
export interface InvoicesCreateRequestBody {
invoice: InvoiceCreatePayload;
}
export interface InvoicesCreateResponse {
body: InvoicesCreateResponseBody;
}
export type InvoicesCreateResponseBody = ErrorResponseBody | InvoiceCreateSuccessResponseBody;
export type InvoicesDestroyResponse = never;
export interface InvoicesIndexRequest {
query: InvoicesIndexRequestQuery;
}
export interface InvoicesIndexRequestQuery {
filter?: InvoiceFilter | InvoiceFilter[];
page?: InvoicePage;
sort?: InvoiceSort | InvoiceSort[];
}
export interface InvoicesIndexResponse {
body: InvoicesIndexResponseBody;
}
export type InvoicesIndexResponseBody = ErrorResponseBody | InvoiceIndexSuccessResponseBody;
export interface InvoicesShowResponse {
body: InvoicesShowResponseBody;
}
export type InvoicesShowResponseBody = ErrorResponseBody | InvoiceShowSuccessResponseBody;
export interface InvoicesUpdateRequest {
body: InvoicesUpdateRequestBody;
}
export interface InvoicesUpdateRequestBody {
invoice: InvoiceUpdatePayload;
}
export interface InvoicesUpdateResponse {
body: InvoicesUpdateResponseBody;
}
export type InvoicesUpdateResponseBody = ErrorResponseBody | InvoiceUpdateSuccessResponseBody;
export interface Issue {
code: string;
detail: string;
meta: Record<string, unknown>;
path: string[];
pointer: string;
}
export type Layer = 'contract' | 'domain' | 'http';
export interface Line {
description: null | string;
id: string;
price: null | number;
quantity: null | number;
}
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;
}OpenAPI
yml
---
openapi: 3.1.0
info:
title: "/eager_lion"
version: 1.0.0
paths:
"/invoices":
get:
operationId: invoicesIndex
parameters:
- in: query
name: filter
required: false
schema:
oneOf:
- "$ref": "#/components/schemas/invoiceFilter"
- items:
"$ref": "#/components/schemas/invoiceFilter"
type: array
- in: query
name: page
required: false
schema:
"$ref": "#/components/schemas/invoicePage"
- in: query
name: sort
required: false
schema:
oneOf:
- "$ref": "#/components/schemas/invoiceSort"
- items:
"$ref": "#/components/schemas/invoiceSort"
type: array
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/invoiceIndexSuccessResponseBody"
description: Successful response
post:
operationId: invoicesCreate
requestBody:
content:
application/json:
schema:
properties:
invoice:
"$ref": "#/components/schemas/invoiceCreatePayload"
type: object
required:
- invoice
required: true
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/invoiceCreateSuccessResponseBody"
description: Successful response
'422':
description: Unprocessable Entity
content:
application/json:
schema:
"$ref": "#/components/schemas/errorResponseBody"
"/invoices/{id}":
get:
operationId: invoicesShow
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/invoiceShowSuccessResponseBody"
description: Successful response
patch:
operationId: invoicesUpdate
parameters:
- in: path
name: id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
invoice:
"$ref": "#/components/schemas/invoiceUpdatePayload"
type: object
required:
- invoice
required: true
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/invoiceUpdateSuccessResponseBody"
description: Successful response
'422':
description: Unprocessable Entity
content:
application/json:
schema:
"$ref": "#/components/schemas/errorResponseBody"
delete:
operationId: invoicesDestroy
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'204':
description: No content
components:
schemas:
customer:
properties:
id:
type: string
name:
type: string
type: object
required:
- id
- name
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"
invoice:
properties:
createdAt:
type: string
format: date-time
customer:
"$ref": "#/components/schemas/customer"
customerId:
type: string
id:
type: string
issuedOn:
type:
- string
- 'null'
format: date
lines:
items:
"$ref": "#/components/schemas/line"
type: array
notes:
type:
- string
- 'null'
number:
type: string
status:
enum:
- draft
- sent
- paid
type: string
updatedAt:
type: string
format: date-time
type: object
required:
- createdAt
- customer
- customerId
- id
- issuedOn
- lines
- notes
- number
- status
- updatedAt
invoiceCreatePayload:
properties:
customerId:
type: string
issuedOn:
type:
- string
- 'null'
format: date
notes:
type:
- string
- 'null'
number:
type: string
status:
enum:
- draft
- sent
- paid
type: string
type: object
required:
- customerId
- number
invoiceCreateSuccessResponseBody:
properties:
invoice:
"$ref": "#/components/schemas/invoice"
meta:
properties: {}
type: object
type: object
required:
- invoice
invoiceFilter:
properties:
AND:
items:
"$ref": "#/components/schemas/invoiceFilter"
type: array
NOT:
"$ref": "#/components/schemas/invoiceFilter"
OR:
items:
"$ref": "#/components/schemas/invoiceFilter"
type: array
number:
oneOf:
- type: string
- "$ref": "#/components/schemas/stringFilter"
status:
"$ref": "#/components/schemas/invoiceStatusFilter"
type: object
invoiceIndexSuccessResponseBody:
properties:
pagination:
"$ref": "#/components/schemas/offsetPagination"
invoices:
items:
"$ref": "#/components/schemas/invoice"
type: array
meta:
properties: {}
type: object
type: object
required:
- pagination
- invoices
invoicePage:
properties:
number:
type: integer
minimum: 1
size:
type: integer
minimum: 1
maximum: 100
type: object
invoiceShowSuccessResponseBody:
properties:
invoice:
"$ref": "#/components/schemas/invoice"
meta:
properties: {}
type: object
type: object
required:
- invoice
invoiceSort:
properties:
createdAt:
enum:
- asc
- desc
type: string
issuedOn:
enum:
- asc
- desc
type: string
status:
enum:
- asc
- desc
type: string
updatedAt:
enum:
- asc
- desc
type: string
type: object
invoiceStatusFilter:
oneOf:
- enum:
- draft
- sent
- paid
type: string
- properties:
eq:
enum:
- draft
- sent
- paid
type: string
in:
items:
enum:
- draft
- sent
- paid
type: string
type: array
type: object
required:
- eq
- in
invoiceUpdatePayload:
properties:
customerId:
type: string
issuedOn:
type:
- string
- 'null'
format: date
notes:
type:
- string
- 'null'
number:
type: string
status:
enum:
- draft
- sent
- paid
type: string
type: object
invoiceUpdateSuccessResponseBody:
properties:
invoice:
"$ref": "#/components/schemas/invoice"
meta:
properties: {}
type: object
type: object
required:
- invoice
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
line:
properties:
description:
type:
- string
- 'null'
id:
type: string
price:
type:
- number
- 'null'
quantity:
type:
- integer
- 'null'
type: object
required:
- description
- id
- price
- quantity
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