Source code is not generated if api spec doesn't have "schemas"
yyamano opened this issue · 1 comments
yyamano commented
If API spec doesn't have "schemas" section, fastapi-code-generator doesn't generate source code.
Here is the api spec file "upload.yaml".
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
description: API definiton for testing file upload
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets/{petId}/image:
post:
summary: Upload image for a pet
operationId: uploadPetImage
tags:
- pets
parameters:
- name: petId
in: path
required: true
description: The id of the pet
schema:
type: string
requestBody:
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
'201':
description: empty response
You can reproduce the problem as below.
C:\Users\yyamano\work\fastapi-code-generator>poetry run python fastapi_code_generator -i tests\data\openapi\default_template\upload.yaml -o tmp
C:\Users\yyamano\work\fastapi-code-generator>ls -l tmp
total 0
C:\Users\yyamano\work\fastapi-code-generator>poetry run python fastapi_code_generator -i tests\data\openapi\default_template\simple.yaml -o tmp
C:\Users\yyamano\work\fastapi-code-generator>ls -l tmp
total 5
-rw-r--r-- 1 yyamano 1049089 1183 Aug 9 16:13 main.py
-rw-r--r-- 1 yyamano 1049089 496 Aug 9 16:13 models.py