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

Apidays Paris 2023 - OpenAPI Extensibility - The Good, The Bad and The Ugly, Oleg Nenashev, WireMock

apidays
December 18, 2023

Apidays Paris 2023 - OpenAPI Extensibility - The Good, The Bad and The Ugly, Oleg Nenashev, WireMock

Apidays Paris 2023 - Software and APIs for Smart, Sustainable and Sovereign Societies
December 6, 7 & 8, 2023

OpenAPI Extensibility - The Good, The Bad and The Ugly
Oleg Nenashev, Community Builder and DevRel Consultant at WireMock

------

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 18, 2023
Tweet

More Decks by apidays

Other Decks in Programming

Transcript

  1. > whoami @oleg_nenashev oleg-nenashev Dr. Nenashev / Mr. Jenkins Developer

    tools hacker Community builder & DevRel consultant #RussiansAgainstPutin #StandWithUkraine
  2. So, but what’s ugly? • No official v3 Documentation •

    V2 specification has not been updated in ages 15
  3. Specification is an inspiration • Nobody cares where “x-” fields

    are supported or not • Almost everything in “x-” fields? Why not • Encrypted data in spec? Why not? • Contribute back? Why? 16 Image source: https://dev.to/meatboy/what-are-mo dern-examples-of-embrace-extend- and-extinguish-21j3
  4. Who is Mr. Jenkins? •Automation server/framework •Popular CI/CD tool •Open-source

    •Big community •More than 1700 plugins •Part of the Continuous Delivery Foundation
  5. 20

  6. 21 New demands Shift left Jenkins evolved … but not

    fast enough for early adopters API
  7. Shifting Gears: Making Changes Aug 31, 2018 – Kohsuke Kawaguchi,

    “Jenkins: Shifting Gears” https://jenkins.io/blog/2018/08/31/shifting-gears/
  8. Swagger OpenAPI specs in Jenkins May plugins implement Swagger/Open API

    specs Recommendation, but not a standard Too difficult to maintain 25 https://www.jenkins.io/blog/2019/08 /16/folder-auth-plugin/#rest-apis-wit h-swagger-support
  9. We wanted to use OpenAPI at Scale • Jenkins has

    in-house web framework (Stapler + Jetty) • Integrations would benefit from a specification and code generator • We could merge all specifications live for each service instance 27
  10. What did I try to put in “x-”? • Authorization

    model • Feature flags • Conditions • Stateful behavior • … 29 Image source: orchid-tech.com/design-notes/ fpga-complex-algorithm-development/
  11. Open API as Code • JSON/YAML extensions are not great

    • OpenAPI specifications are huge and not sustainable as is • It is an interexchange format • 99% of specifications are generated by tools • OpenAPI DSLs 32
  12. 35 WireMock 101 WireMock is a tool for building mock

    APIs 5M+ downloads a month Available beyond Java, inc Rust or Golang You can can: • Create stable development environments • Isolate yourself from flakey 3rd parties • Simulate APIs that don't exist yet wiremock.org
  13. 36 wiremock.org/docs/stubbing IF (request_url) THEN (response) * * it gets

    MUCH more complex WireMock Config JSON: Client library response request Client App Mock API Server HTTP/2
  14. WireMock Cloud by WireMock Inc. 41 • WireMock creator is

    a co-founder of the Inc. • WireMock Cloud - SaaS for end-to-end API mocking • Private beta: K8s Edition for managed / on-premises • OpenAPI co-development wiremock.io
  15. OpenAPI in WireMock Cloud • Full import of OpenAPI =>

    mock API • Bidirectional, incremental OpenAPI <=> mock API generation • Request and response validation • Generation of both specific and loose matching stubs 44 NOTE: Vendor neutral talk, no demo
  16. OpenAPI Spec Extensions in WireMock Cloud • x-faker - specify

    the random value generator for a schema element • x-parameter-values - to specify values of the request parameters associated with a specific response example • x-wiremock-hash - tracking of changes for synchronization 45 NOTE: Vendor neutral talk, no demo
  17. 46

  18. OpenAPI 4 “Moonwalk” • Eliminate complexity • Support APIs that

    have different responses based on query parameters, headers and request bodies. • Support a broader range of URL design patterns • Reduce nested structures to improve readability and editability • Improve reusability of request and response patterns 49 https://github.com/OAI/moonwalk
  19. Moonwalk - My wishlist • ASAP: Get it released! ◦

    Later: Other stuff is later • OpenAPI DSL • Adopt popular extensions • Built-in Authorization • Connect Parameters/Responses/Examples • Learn from API Modeling tools 50
  20. Takeaways 53 • OpenAPI Extensions are a an engine to

    consider • Extensions help where the specification does not • OpenAPI 4 Moonwalk will change the things a lot!
  21. How to participate NOW • Share feedback! • Evolve the

    spec beyond Swagger • Adopt the spec 55
  22. 56