rescript-openapi 0.1.0

Generate type-safe ReScript clients from OpenAPI specifications
Documentation
---
source: tests/codegen_tests.rs
assertion_line: 111
expression: output
---
// SPDX-License-Identifier: PMPL-1.0-or-later
// Generated by rescript-openapi - DO NOT EDIT
// Source: Swagger Petstore v1.0.0

open RescriptCore
module S = RescriptSchema.S

type error = {
  code: int,
  message: string,
}
let errorSchema: S.t<error> = S.object(s => ({
  code: s.field("code", S.int),
  message: s.field("message", S.string),
}: error))


type status = [
  | #Idle
  | #Busy
  | #Processing
]
let statusSchema: S.t<status> = S.union([
  S.literal(#Idle),
  S.literal(#Busy),
  S.literal(#Processing),
])


type pet = {
  id: int,
  name: string,
  tag: option<string>,
  status: option<status>,
}
let petSchema: S.t<pet> = S.object(s => ({
  id: s.field("id", S.int),
  name: s.field("name", S.string),
  tag: s.fieldOr("tag", S.option(S.string), None),
  status: s.fieldOr("status", S.option(statusSchema), None),
}: pet))


type pets = array<pet>
let petsSchema = S.array(petSchema)