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

Make it possible to add custom API documentation based on the deployment location #6355

Open
wants to merge 10 commits into
base: dev-2.x
Choose a base branch
from

Conversation

t2gran
Copy link
Member

@t2gran t2gran commented Jan 2, 2025

Summary

This PR introduce a new configuration parameter to load a deployment specific properies file.

router-config.json

{
  "server": {
    "apiDocumentationProfile" : "entur",
 ...

custom-documentation-entur.properties

TariffZone.description=A **zone** used to define ...

Syntax properties file

Use:

<TypeName>[.<FieldName>].(description|deprecated)[.append]

Examples

Replace the existing type description

Quay.description=The place for boarding/alighting a vehicle

Append to the existing type description

Quay.description.append=This is appended

Replace the existing field description

Quay.name.description=The name of a Quay is ...

Append to the existing field description

Quay.name.description.append=(Source NSR)

Insert deprecated reason. Due to a bug in the Java GraphQL lib, an existing deprecated reason cannot be updated, but it can be deprecated if not already marked. Deleting the reason from the schema, and adding it back using
the "default" TransmodelApiDocumentationProfile can be used as a workaround. The problem is reported to the Java GraphQL Prodject here: graphql-java/graphql-java#3786.

Quay.name.deprecated=This field is deprecated ...

Issue

🟥 No isse exist for this.

Unit tests

✅ All new code have unit-tests

Documentation

✅ JavaDoc and user doc is added/updated.

Changelog

✅ This is a new feature

Bumping the serialization version id

🟥 Not needed

@t2gran t2gran added New Feature Entur Test This is currently being tested at Entur labels Jan 2, 2025
@t2gran t2gran added this to the 2.7 (next release) milestone Jan 2, 2025
@t2gran t2gran requested a review from a team as a code owner January 2, 2025 12:34
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 83.94161% with 22 lines in your changes missing coverage. Please review.

Project coverage is 69.82%. Comparing base (4198bb6) to head (106ab13).
Report is 97 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...support/graphql/injectdoc/CustomDocumentation.java 74.35% 6 Missing and 4 partials ⚠️
...pplanner/utils/text/TextVariablesSubstitution.java 86.20% 2 Missing and 2 partials ⚠️
...t/graphql/injectdoc/InjectCustomDocumentation.java 92.10% 2 Missing and 1 partial ⚠️
...anner/apis/transmodel/TransmodelGraphQLSchema.java 71.42% 1 Missing and 1 partial ⚠️
...framework/project/EnvironmentVariableReplacer.java 87.50% 1 Missing ⚠️
...r/standalone/config/routerconfig/ServerConfig.java 87.50% 1 Missing ⚠️
...ner/standalone/configure/ConstructApplication.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6355      +/-   ##
=============================================
- Coverage      69.85%   69.82%   -0.03%     
- Complexity     17926    17993      +67     
=============================================
  Files           2035     2050      +15     
  Lines          76508    76792     +284     
  Branches        7825     7840      +15     
=============================================
+ Hits           53442    53619     +177     
- Misses         20325    20424      +99     
- Partials        2741     2749       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

In the case used, we compare to GraphQL schemas.
@t2gran t2gran force-pushed the custom-doc-transmodel-api branch from 4de6666 to 0bf3c72 Compare January 2, 2025 14:10
@t2gran t2gran added the bump serialization id Add this label if you want the serialization id automatically bumped after merging the PR label Jan 7, 2025
Copy link
Member

@leonardehrenfried leonardehrenfried left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few things that I picked up on, mainly that properties files in Java are assumed to be ISO-8869-1.

@t2gran t2gran removed the bump serialization id Add this label if you want the serialization id automatically bumped after merging the PR label Jan 7, 2025
@t2gran t2gran force-pushed the custom-doc-transmodel-api branch from 06b76b4 to 106ab13 Compare January 13, 2025 22:24
@t2gran t2gran removed the Entur Test This is currently being tested at Entur label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants