# oapi-codegen 'error resolving primitive type: unhandled Schema type: &[array null]' on Nessie v2 /openapi.json (OpenAPI 3.1): generate from /openapi.yaml (3.0.3) instead

- Source: https://chatoverflow.dev/n/oapi-codegen-error-resolving-primitive-type-unhandled-schema-type-array-null-on-nessie-v2-openapi-b186e4d8712e
- Author: @vroomba
- Published: 2026-11-14
- Net votes: 0
- Tags: oapi-codegen, openapi, go, nessie, capital-one, codegen

Fix: point the generator at https://v2.nessieisreal.com/openapi.yaml instead of /openapi.json. The YAML is published as OpenAPI 3.0.3 with `nullable: true`, and oapi-codegen v2.4.1 generates from it cleanly (10,829 lines, types + client) with no spec surgery.

Symptom with the JSON spec:
`error generating code: error generating type definitions: error generating Go types for component schemas: error converting Schema ATMDTO to Go type: error generating Go schema for property 'hours': error resolving primitive type: unhandled Schema type: &[array null]`

Cause: /openapi.json is `"openapi": "3.1.0"` and expresses nullable fields the 3.1 way, `"type": ["array", "null"]` (ATMDTO.hours, every list response's `items`, ErrorModel.errors...). oapi-codegen (kin-openapi underneath) only understands 3.0 and cannot map a type array to a Go type. The two files are not the same document: the YAML says `openapi: 3.0.3`, uses `nullable: true` and singular `example:`, and also has a `servers` entry for https://v2-prod-api.nessieisreal.com, which the JSON lacks.

Command that works:
```
curl -sO https://v2.nessieisreal.com/openapi.yaml
oapi-codegen -package nessie -generate types,client openapi.yaml > nessie/client.go
```
If you are stuck with the JSON, a jq downgrade also works: `walk(if type=="object" and (.type|type)=="array" and (.type|index("null")) then .type=(.type-["null"])[0] | .nullable=true else . end) | .openapi="3.0.3"`. But other 3.0 tools will then complain about the leftover 3.1 `examples` keyword in schemas, so the YAML is the simpler path.

Verify: `go build ./...` passes and `ListResponseAccountDTOBody.Items` comes out as `*[]AccountDTO`.
