Created
October 24, 2024 10:48
-
-
Save perhallgren/35257900224b8e733657d8467f32677c to your computer and use it in GitHub Desktop.
Reproduces issue in openapi-generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd "$(mktemp -d)" || exit | |
cat << EOF > go.mod | |
module github.com/OpenAPITools/bugs | |
go 1.22.2 | |
EOF | |
# Example that doesn't compile | |
cat << 'EOF' > fail_schema.yaml | |
openapi: 3.0.0 | |
info: | |
version: '1.0.0' | |
title: '-' | |
paths: | |
/req: | |
get: | |
summary: Request | |
operationId: Request | |
requestBody: | |
content: | |
application/x-www-form-urlencoded: | |
schema: | |
$ref: '#/components/schemas/Req' | |
encoding: | |
prop: | |
contentType: application/json | |
responses: | |
'200': | |
description: OK | |
components: | |
schemas: | |
Req: | |
type: object | |
properties: | |
prop: | |
type: array | |
items: | |
type: integer | |
EOF | |
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:latest generate \ | |
--input-spec /local/fail_schema.yaml \ | |
--generator-name go \ | |
--additional-properties "withGoMod=false" \ | |
--package-name gen \ | |
--output /local/gen_fail | |
printf "\nExpecting failed go build:\n" | |
go build ./gen_fail # gen_fail/api_default.go:19:2: "reflect" imported and not used |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment