Tripletex / Tripletex/tripletex-api2

Optional types in schema, ex: GET /employee returns values where id is optional

Open
#84 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
49
Forks
47
Avg merge
1h 1m
Merged PRs (30d)
1

Description

We are using https://openapi-ts.pages.dev/ to generate client code and there are optional types in Tripletex's swagger schema which I believe could have been marked as required. Example Employee and it's id:

image

This results in generated code where id is optional:

image

I'm guessing this may have to do something with type being used in multiple contexts, like when you POST a new employee? But it would have been nice to have accurate types for different operations :)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the OpenAPI/Swagger schema for Employee and compare the GET /employee response with the POST request model. Inspect how shared types mark id as optional, then use openapi-ts to verify the generated types. Done means the schema accurately distinguishes required response fields from fields that may be absent when creating an employee.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.