Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): add openapi specification #3540

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ReenigneArcher
Copy link
Member

@ReenigneArcher ReenigneArcher commented Jan 16, 2025

Description

This PR will attempt to provide an openapi spec for the Sunshine rest API. I am not an expert on this, but I believe once this is available it will be possible to automatically create SDKs in various languages using an SDK generator (https://openapi.tools/#sdk).

The idea came from https://plexapi.dev/Open-API-Specification which generates SDKs using "Speakeasy". Unfortunately, I don't believe Speakeasy has a generous open source license/option, so other generators may need to be considered. Still, the repo has been a good example, starting with the main spec file - https://github.com/LukeHagar/plex-api-spec/blob/main/src/pms-spec.yaml

Additionally, there are spec generators for various languages, but none seem to be available for c++, understandably, so this is being manually created.

TODO:

  • CI, build API docs using redoc, lint, etc. redoc: https://dev.to/heymich/a-guide-to-creating-api-documentation-with-redoc-and-github-pages-4i4a
  • see if this even works
    • postman
    • redocly in CLion (not working... probably CORS issue)
    • swagger in CLion (not working... probably CORS issue)
  • add all endpoints
  • generate version number (and other variables) during build/release
  • generate/publish SDKs (possibly in separate repos)
  • return properly serialized json (boolean, integer) values (probably not this PR)... then remove "types" directory

Other notes:

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 10.30%. Comparing base (7f0351d) to head (42a3e9a).

Files with missing lines Patch % Lines
src/confighttp.cpp 0.00% 3 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           master    #3540     +/-   ##
=========================================
  Coverage   10.30%   10.30%             
=========================================
  Files          90       90             
  Lines       16130    16130             
  Branches     7655     7655             
=========================================
  Hits         1662     1662             
+ Misses      13911    11918   -1993     
- Partials      557     2550   +1993     
Flag Coverage Δ
Linux 9.68% <0.00%> (ø)
Windows 10.77% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/confighttp.cpp 0.00% <0.00%> (ø)

... and 32 files with indirect coverage changes

@ReenigneArcher ReenigneArcher force-pushed the feat/api/add-openapi-specification branch from 3e6b2ff to 1158cf4 Compare January 16, 2025 02:31
@ReenigneArcher ReenigneArcher force-pushed the feat/api/add-openapi-specification branch from 1158cf4 to 42a3e9a Compare January 16, 2025 03:03
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 New issue
1 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant