Upgrade to Pro — share decks privately, control downloads, hide ads and more …

apidays Paris 2024 - Generate OpenAPI Schema fr...

apidays
December 22, 2024

apidays Paris 2024 - Generate OpenAPI Schema from Golang Code with the Fuego Framework, Ewen Quimerc'h and Edouard Lacourt, Theodo

Generate OpenAPI Schema from Golang Code with the Fuego Framework
Ewen Quimerc'h, Software Engineer at Theodo
Edouard Lacourt, Software Engineer at Theodo

apidays Paris 2024 - The Future API Stack for Mass Innovation
December 3 - 5, 2024

------

Check out our conferences at https://www.apidays.global/

Do you want to sponsor or talk at one of our conferences?
https://apidays.typeform.com/to/ILJeAaV8

Learn more on APIscene, the global media made by the community for the community:
https://www.apiscene.io

Explore the API ecosystem with the API Landscape:
https://apilandscape.apiscene.io/

apidays

December 22, 2024
Tweet

More Decks by apidays

Other Decks in Programming

Transcript

  1. A major issue working with APIs API Consumers (front, other

    APIs, mobile app…) How can consumers and API systems exchange information seamlessly? GET data Bad request Route does not exist 500 errors
  2. OpenAPI: the good is the ug ly … but it’s

    unreadable & unmaintainable for humans 🤢🤢 Everything is declared & standardised ❤ … נ
  3. Swagger UI, the OpenAPI for humans REST API Machines Humans

    Raw JSON/YAML spec Swagger Browser Client Generators ❓
  4. Server- sid e Op e nAPI sta te of the

    a rt 1. Generate OpenAPI spec from source code 2. Generate server code from existing OpenAPI spec Server code boilerplate interfaces
  5. צ תּכּ לּ אמּףּ כֿפֿﭏ ם יּ לּ ﭏﭏלּ כֿ

    ﭏסּ טּ שּ ק תּךּ אמּףּ כֿפֿﭏע Faster Prototyping Code agility > Specification burden Ease of Use Code familiar for developers > learn a specification format. Flexibility Refactor code > Refactor yaml spec Less Emphasis on Design Tool Limitations
  6. OpenAPI state of the art : mostly in dynamic la

    ng ua g e s No Go code-first framework? We should create one! - Strong static typing - Good performance - Error as values - Simplicity ❓
  7. Introducing Fuego 🔥🔥 100% accurate OpenAPI generation in Go Using

    la te st fe a ture s of the Go p rog ra m m ing la ng ua g e (g e ne ric s, b uilt- in route r… )
  8. Fuego 🔥🔥 fe a ture s Compatible with Go std

    lib (no lock - in) : Use any http.Handler middleware or handler! Fuego also supports log/slog, context and html/template. ﬠ לּ כֿףּטּ קּףּ؛ טּ ﭏףּתּשּגק לּ פֿלּ כֿףּטּ קּףּ؛ טּ ﭏףּתּשּם ש‌ לּ נּ תּ טּ ‌ ﭏתּרּ טּ ﭏףּ ךּ טּ קּ קּ ، פֿלּ כֿףּ טּ קּ ףּ ؛לּ פֿ טּ שּכּ כּ לּ פֿלּ כֿףּ טּ קּ ףּ ؛לּ פֿ ײﬠ� � ׃ אַ₪״ טּ שּכּ װשׁ₪״ שתּכֿרּ פֿ יּ טּ פֿלּ כּ תּשּ ‌ פֿלּ כֿאוֹ כֿתּ‍ ףּ כּ לּ כּ פֿﭏכֿ‌ ךּ ﭏפֿ ֿ תּכֿ שּתּﭏ׃ ףּ מּ ، תּ‌ ‎ טּ שּﭏ ﭏתּ כּ תּ ףּ ﭏ ، תּ‌ כֿפֿלּ קּ מּ׀ שּׁ טּ קּףּכּ טּ ﭏףּתּשּם פֿףּ רּ וֹ קּ לּ ‍ טּ קּ ףּ כּ טּ ﭏתּכֿ יּ טּ פֿלּ כּ תּשּ נּ תּאוֹ קּ טּ ، נּ כֿתּ‌ שּכּ ג‍ טּ קּ ףּ כּ טּ ﭏתּכֿ Transformation : e a sily tra nsform your d a ta b y im p le m e nting the fue g o.InTra nsform a nd fue g o.OutTra nsform inte rfa c e s - a lso use ful for c ustom va lid a tion רכֿכֿתּכֿ סּ טּ שּכּ קּףּשּנּ ם צ לּ שּﭏכֿטּ קּ ףּ ؛לּ כּ לּ כֿכֿתּכֿ סּ טּ שּכּ קּ ףּ שּנּ ‎ ףּ ﭏסּ ﭏסּ לּ פֿﭏטּ שּכּ טּ כֿכּ � שצ ל חטךב Rendering / content - negociation : Sim p le a nd fa st re nd e ring syste m b a se d on htm l/ te m p la te - you c a n still a lso use your own te m p la te syste m like te m p l or g om p one nts
  9. ױ שּﭏלּ נּ כֿטּ ﭏףּ שּנּ ש‌ לּ נּ תּ

    🔥🔥 ףּ שּ ، תּ‌ כֿ ‎ תּכֿצּמּקּ תּ‎ ﬠ ﭏטּ כֿﭏאﭏףּרּ לּ ת לּ שּלּ כֿטּ ﭏףּתּשּםשּלּ ‍ לּ כֿ נּ לּ ﭏ תּ‌ ﭏאתּמּאכּ טּ ﭏלּ ם ‎ סּ לּ שּ ﭏסּ לּ פֿלּ כֿ‍ לּ כֿ פֿﭏטּ כֿﭏפֿ׃ ﭏסּ לּ כּ תּךּ ‌ רּ לּ שּﭏטּ ﭏףּ תּשּ ףּ פֿ ‌ וֹ כּ טּ ﭏלּ כּ Expose the running API in non- p rod e nvs Op t- in On - demand generation : g e ne ra te without sta rting the se rve r Golden file ta rg e t Oa sd iff - se e the difference b e twe e n the old sp e c a nd the ne w one in HTML LOCAL ACROSS TEAMS
  10. שּׂ סּ טּ ﭏ � וֹ לּ שּאﬠתּ‌ כֿךּ לּ

    יּ כֿתּ‌ נּ סּ ﭏ ‌ פֿ - Sharing a minimal working version does not stop a project from being exposed under the spotlight - Project hype & fun : 900+ stars, 25 contributors, a lot of kind comments & issues to improve the framework: community is awesome - Known in our company for being the Open-Source guys - Talks & meetups! Don’t be shy, it works
  11. Fuego: an OpenAPI fra m e work Thanks! ר‎ לּ

    שּ � שׂױ ₪ר� צ ﻠװ רכּ תּ‌ טּ כֿכּ ״פ צ � שׂ� שׁ go - fuego/fuego