# toSchemaV3

FUNCTION in `@skmtc/core 0.63.4`

Parses one OpenAPI 3.0 schema, for the tests of a generator. A `$ref` gives
an `OasRef`. In a run, the schemas are already parsed.

Give it only OpenAPI 3.0 schemas. It does not read a `type` that is an
array, such as the OpenAPI 3.1 `type: ['string', 'null']`. The result is
usually an `OasUnknown`. If another keyword, such as `format`, `enum`
or `properties`, shows the type, the result has that type and loses `null`.
With `allOf`, `oneOf` or `anyOf`, it can throw.

## Signature

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

toSchemaV3(args: ToSchemaV3Args): OasSchema | OasRef<'schema'>
```

## Parameters

- `args` (ToSchemaV3Args, required)
  - `schema` (OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject, required)
  - `stackTrail` (StackTrail, required)
  - `context` (ParseContextType, required)

## Returns

`OasSchema | OasRef<'schema'>`

## Throws

- `Error`: When it cannot parse the schema. For example, a schema has `not`, and `parse.not` is `strict`, which is the default.
