Skip to content

Migration to internal API Spec#101

Open
paulwiese wants to merge 9 commits into
mainfrom
feat/internal-api-spec
Open

Migration to internal API Spec#101
paulwiese wants to merge 9 commits into
mainfrom
feat/internal-api-spec

Conversation

@paulwiese

@paulwiese paulwiese commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Removed forwarded-request schemas from openapi.yaml

Setup openapi-internal.yaml
Adapted gen-all.sh

Migrated spring-api, py-help-service, py-recipe-service to new internal specification

Deployed Swagger UI for the public and internal api spec at localhost:8083 via the docker-compose in root

@paulwiese paulwiese marked this pull request as ready for review June 16, 2026 17:39
@paulwiese paulwiese requested review from imol-ai and jschoedl June 16, 2026 17:39
Comment thread api/scripts/gen-all.sh
openapi-generator-cli generate \
-i api/openapi-internal.yaml \
-g kotlin \
--global-property="apis,models" \

@jschoedl jschoedl Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a reason why we'd need those generated docs files? Otherwise I'd drop them

Suggested change
--global-property="apis,models" \
--global-property="apis,models,apiDocs=false,modelDocs=false" \

load_dotenv()

app = FastAPI(title="Cooking Assistant GenAI Service")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
@app.exception_handler(HTTPException)
async def http_exception_handler(request: Request, exc: HTTPException):
body = exc.detail if isinstance(exc.detail, dict) else {"message": exc.detail}
return JSONResponse(status_code=exc.status_code, content=body, headers=exc.headers)

The current code returns {detail: {message: ...}} instead of {message: ...} on error. (same in the recipe service)

Comment on lines +92 to +97
if (!response.isSuccessful) {
throw ResponseStatusException(
HttpStatus.BAD_GATEWAY,
"Upstream service returned error: ${response.code()}",
)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This returns a 502 BAD GATEWAY for every kind of error with GenAI and discards the error message...

Comment thread api/openapi-internal.yaml

HelpRequestForwarded:
type: object
required: [profile, prompt]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why not the recipe too?

Comment thread api/scripts/gen-all.sh
-o services/spring-api

# delete lines causing compilation failures because of missing references
sed -i '' '/org.openapitools.client.infrastructure/d' services/spring-api/src/main/kotlin/org/openapitools/internal/client/*ServiceApi.kt

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

sed -i '' ...' only works on MacOS, not on "normal" Linux. But do we actually need this line at all?

Comment thread api/openapi-internal.yaml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This file contains a few schemas at the end that are not used anywhere, I guess they could be removed?

  AuthResponse                                                                                        
  AuthRequest                                                                                         
  UserCredentials                                                                                     
  UserProfileUpdate                                                                                   
  RecipeUpdate                                                                                        
  RecipeCreated                                                                                       
  Recipe                                                                                              
  RecipeRequest                                                                                       
  HelpRequest   

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.

2 participants