Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Change the base server url in OpenAPI generated code at runtime
Qt 6.11 is out! See what's new in the release blog

Change the base server url in OpenAPI generated code at runtime

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 238 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chubinou
    wrote last edited by aha_1980
    #1

    Pretty much what's in the title. I'm trying to use the new OpenAPI client generator from Qt, the API I'm trying to use is not tied to a particular server so I need to be able to set the server base url at runtime. I didn't find a way set it from generated openapi client (tested using Qt 6.11.2). the API documentation is very sparse maybe I missed something.

    A possible workaround I can think of would be to patch the openapi yaml to set a server with a template variable for the hostname.

    SGaistS 1 Reply Last reply
    0
    • Nils SjobergN Offline
      Nils SjobergN Offline
      Nils Sjoberg
      wrote last edited by
      #2

      Add a servers block to the YAML with a template variable for the hostname (exactly as the poster suggested), re-run qt_add_openapi_client, and then search the header files.

      "What's up, Doc?"

      1 Reply Last reply
      0
      • C Chubinou

        Pretty much what's in the title. I'm trying to use the new OpenAPI client generator from Qt, the API I'm trying to use is not tied to a particular server so I need to be able to set the server base url at runtime. I didn't find a way set it from generated openapi client (tested using Qt 6.11.2). the API documentation is very sparse maybe I missed something.

        A possible workaround I can think of would be to patch the openapi yaml to set a server with a template variable for the hostname.

        SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote last edited by
        #3

        @Chubinou hi and welcome to devnet,

        Do you have a known set of servers or just "anywhere is possible" ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt
        • Unsolved