# OasBoolean

CLASS in `@skmtc/core 0.63.4`

A boolean schema: the `OasSchema` whose `type` is `'boolean'`.

`enums` can limit its values. For example, a schema that accepts only `true`
has `[true]`.

## Signature

```ts
import { OasBoolean } from '@skmtc/core'

class OasBoolean<Nullable extends boolean | undefined = boolean | undefined> extends OasBase
```

## Constructor

### constructor

```ts
constructor(fields?: BooleanFields<Nullable>, context?: ParseContextType)
```

## Properties

- `oasType` ('schema'): Object is part the 'schema' set which is used to define data types in an OpenAPI document.
- `type` ('boolean'): Constant value 'boolean' useful for type narrowing and tagged unions.
- `title` (string | undefined): A short summary of the boolean.
- `description` (string | undefined): A description of the boolean.
- `nullable` (Nullable | undefined): Indicates whether value can be null.
- `extensionFields` (Record<string, unknown> | undefined): Specification Extension fields
- `example` (Nullable extends true ? boolean | null | undefined : boolean | undefined): An example of the boolean.
- `enums` (Nullable extends true ? (boolean | null)[] | undefined : boolean[] | undefined): Possible values the boolean can have
- `default` (Nullable extends true ? boolean | null | undefined : boolean | undefined): The default value of the boolean.
- `readOnly` (boolean | undefined): Whether the boolean is read-only
- `writeOnly` (boolean | undefined): Whether the boolean is write-only
- `deprecated` (boolean | undefined): Whether the boolean is deprecated
- `not` (OasUnknown | undefined): The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json` `parse.not: unknown`: the document says "not something", and core does not read what. `undefined` otherwise.

## Methods

### isRef

```ts
isRef(): this is OasRef<'schema'>
```

Determines if this boolean is a reference object.

Returns: Always returns false since this is a concrete boolean instance, not a reference

### isReadOnly

```ts
isReadOnly(): boolean
```

Whether the value is `readOnly`: sent by the API only, never in a request.

### isWriteOnly

```ts
isWriteOnly(): boolean
```

Whether the value is `writeOnly`: sent in a request only, never by the API.

### clone

```ts
clone(ref?: OasRef<'schema'>): OasBoolean
```

A copy of this schema with what `ref` adds at its site applied: its
`nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that
this type takes, a sibling's value winning. A value that does not fit
this type is left out (the parser reports it). For `OasRef.resolve()`.
This schema does not change, and the copy shares its child schemas.

### traverse

```ts
traverse(path: SchemaPath): OasSchema | OasRef<'schema'>
```

### resolve

```ts
resolve(): OasBoolean<Nullable>
```

Resolves this boolean object.

Returns: The boolean instance itself since it's already a concrete object, not a reference

### resolveOnce

```ts
resolveOnce(): OasBoolean<Nullable>
```

Resolves this boolean object one level.

Returns: The boolean instance itself since it's already a concrete object, not a reference

### toJsonSchema

```ts
toJsonSchema(options?: ToJsonSchemaOptions): OpenAPIV3.NonArraySchemaObject
```

Converts this OAS boolean to an OpenAPI v3 JSON schema representation.

- `options`: Conversion options (currently unused for boolean schemas)

Returns: OpenAPI v3 boolean schema object with type and all validation constraints
