Setup
Schemas
Use local or remote schema
By default NuxtOpenFetch searches for OpenAPI schemas in /openapi/[client]
directory, where [client]
is the name specified in the Nuxt config (f.e. pets
):
nuxt.config.ts
export default defineNuxtConfig({
openFetch: {
clients: {
pets: {
baseURL: 'https://petstore3.swagger.io/api/v3/'
}
}
}
})
openapi/
pets/
openapi.yaml
nuxt.config.ts
You can manually specify schema for each client using schema option in Nuxt config.
nuxt.config.ts
export default defineNuxtConfig({
openFetch: {
clients: {
pets: {
schema: 'https://petstore3.swagger.io/api/v3/openapi.json' // remote schema
// schema: './customFolder/myschema.json' - custom local schema file
}
}
}
})