Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.68 KB

README.md

File metadata and controls

48 lines (36 loc) · 1.68 KB

codecov

space_gen

Simple, hackable Open API generator for Dart

This is not designed to be a full implementation of OpenAPI. Currently just enough to generate beautiful Dart bindings for spacetraders.io.

Patches welcome to expand it to support a wider set of OpenAPI.

NOTE: This readme as written is aspirational. The code is not yet all working.

Usage

dart run space_gen

Values

  • Generates good quality, modern Dart code
  • Not a complete implementation of OpenAPI
  • Generates layered output, which can be used in pieces (TBD)
  • Generates testable (and tested) code (TBD)

Intended Design (TBD)

  • Phases
    • Parse OpenAPI
    • Resolve references
    • Render Dart code

Todo

  • OpenAPI does one-class-per-file, remove "models".
  • OpenAPI uniques inline schema based on property layout ignoring names.
  • Add support for required keys.
  • Actually make the networking work.
  • Implement operator== and hashCode?
  • Avoid keyword collisions in property names (e.g. yield).
  • Generate tests. #1

Advantages over Open API Generator 7.0.0

  • Dart 3.0+ only (sound null safety)
  • Model code round trips through JSON correctly (TBD)

Why not just contribute to OpenAPI?

As of August 2023, there are two separate (soon to be combined?) OpenAPI generators for Dart. One for package:http and one for package:dio. I only ever used the http one and it had lots of bugs. I looked at fixing them in OpenAPI, but failed to figure out how to hack on the OpenAPI generator (Java) or successfully interact with the community (several separate slacks).