From 341c02454736c73f5c6b739fa4a94ce4bcb88497 Mon Sep 17 00:00:00 2001 From: Vojtech Mares Date: Sat, 21 Sep 2024 12:09:08 +0200 Subject: [PATCH] feat: initial commit --- .editorconfig | 17 +++++++++++++++++ README.md | 27 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .editorconfig create mode 100644 README.md diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..752200e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +end_of_line = lf +max_line_length = null + +[Makefile] +indent_style = tab + +[*.go] +indent_style = tab +indent_size = 4 diff --git a/README.md b/README.md new file mode 100644 index 0000000..2cda6a5 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Backoffice API + +Backoffice API for my training activities etc. maybe workshops in the future. + +## API + +The API is going to be REST with OpenAPI specification and Swagger (or similar) UI for development. In the future this may change and for example gRPC (Connect RPC :eyes:). + +The API scheme resides in the [`api/`](/api) directory. With major version like [**v0**](/api/v0), **v1**,... being subdirectories. + +### API and code + +The code is generated from API schema, not the other way around (schema from code). + +For this, I am using [oapi-codegen](https://github.com/oapi-codegen/oapi-codegen). The other project considered was [ogen](https://github.com/ogen-go/ogen). This choice may be review in the future. + +My main concern with **oapi-codegen** is with optional fields, since pointers are used while **ogen** is utilizing Go's generics. Which I feel may be a better fit. + +### API versioning + +I want to split major versions (:warning: breaking changes) with folders in code and also in URL path. + +This is done mainly to gain experience with such approach. + +The first of API scheme iteration is marked as **v0**, since I expect not to get everything right the first time and I want to try this approach while designing the API. Altho it's just a number and there is no reason between **v0**, **v1**, **v2**,... + +Current major API version is [v0](/api/v0).