Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [CPP] [pistache-server] Generated code fails to build with x86_64-linux-gnu-g++-13 #19683

Open
5 tasks done
winkler-pixop opened this issue Sep 26, 2024 · 0 comments · May be fixed by #19684
Open
5 tasks done

[BUG] [CPP] [pistache-server] Generated code fails to build with x86_64-linux-gnu-g++-13 #19683

winkler-pixop opened this issue Sep 26, 2024 · 0 comments · May be fixed by #19684

Comments

@winkler-pixop
Copy link

winkler-pixop commented Sep 26, 2024

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
Description

Generated sources for cpp-pistache-server, fails to compile with x86_64-linux-gnu-g++-13 . The particular issue is

Actual output:

[ 95%] Building CXX object CMakeFiles/api-server.dir/main-api-server.cpp.o                                                                                                                                                                
/tmp/foo/cpp/model/Helpers.cpp:28:27: error: ‘uint16_t’ does not name a type                                                                                                                                                              
   28 |     bool isLeapYear(const uint16_t year) {                                                                                                                                                                                        
      |                           ^~~~~~~~                                                                                                                                                                                                
/tmp/foo/cpp/model/Helpers.cpp:14:1: note: ‘uint16_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?                                                                                                           
   13 | #include <regex>                                                                                                                                                                                                                  
  +++ |+#include <cstdint>                                                                                                                                                                                                                
   14 | 

Expected output:

...
...
[ 82%] Building CXX object CMakeFiles/api-server.dir/model/Helpers.cpp.o
[ 82%] Building CXX object CMakeFiles/api-server.dir/api/SecurityApi.cpp.o
[ 86%] Linking CXX executable api-server
[100%] Built target api-server
openapi-generator version

master @ 29c3b02

OpenAPI declaration file content or url
openapi: 3.0.2
servers:
  - url: http://localhost/v3
    description: Localhost. Might use live data.

info:
  description: |-
    This is a demonstration API
  version: 1.0.1
  title: Fubar API
  termsOfService: 'http://foo.bar.com/tos'
  contact:
    email: [email protected]

tags:
  - name: Foos
    description: Anything related to Foos

paths:

  /foo:

    get:
      summary: Returns a foo
      operationId: returnFoo
      tags: [ Foos ]

      responses:
        '200':
          description: A Foo fresh from the Bar.
          content:
            text/plain:
              schema:
                type: string
                example: "Foo"
Generation Details
Steps to reproduce
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g cpp-pistache-server  -i api.yaml  -o cpp
cd cpp
cmake .
make -j
Related issues/PRs
Suggest a fix

I suggest adding

#include <cstdint>

to the relevant Mustache template.

@winkler-pixop winkler-pixop changed the title [BUG] [CPP] [pistache-server] [BUG] [CPP] [pistache-server] Generated code fails to build with x86_64-linux-gnu-g++-13 Sep 26, 2024
winkler-pixop added a commit to winkler-pixop/openapi-generator that referenced this issue Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant