Skip to content

Quiz exercises: Add quiz endpoints to the generated API contract - #13550

Open
Nihad74 wants to merge 5 commits into
developfrom
feature/quiz-exercises/integrate-quiz-openapi-generation
Open

Quiz exercises: Add quiz endpoints to the generated API contract#13550
Nihad74 wants to merge 5 commits into
developfrom
feature/quiz-exercises/integrate-quiz-openapi-generation

Conversation

@Nihad74

@Nihad74 Nihad74 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Integrate the complete Quiz module into OpenAPI generation. The generated contract now contains all 29 Quiz HTTP operations, models polymorphic quiz payloads as typed unions, and produces compile-safe Angular services and models without migrating existing Quiz call sites.

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) and too complex database calls.
  • I strictly followed the principle of data economy for all database calls.
  • I strictly followed the server coding and design guidelines and the REST API guidelines.
  • I added integration-test coverage for the new response discriminator contracts.

Client

  • I strictly followed the client coding guidelines.
  • I added a Vitest regression test for conversion of regenerated tutorial-group summary DTOs without shared nested references.

Motivation and Context

OpenAPI generation previously scanned only the Quiz training package. Most Quiz REST resources were therefore absent from openapi/openapi.yaml, and several polymorphic request and response contracts could not be represented safely by the client generator.

This change integrates the complete quiz.web namespace while preserving the existing runtime behavior and Angular Quiz facades. It also fixes the source DTO and schema contracts required for strict, unambiguous generation instead of patching the generated YAML.

Description

  • Expand the springdoc scan from quiz.web.training to the complete quiz.web namespace.
  • Add endpoint-specific student-response wrappers with the before-quiz-start, live-quiz, and after-quiz-end discriminator values.
  • Model Quiz questions, submitted answers, statistics, and participation responses as three-branch OpenAPI unions for multiple-choice, drag-and-drop, and short-answer payloads.
  • Keep solution-free schemas free of solution-only properties.
  • Extend OpenAPI post-processing to emit TypeScript union aliases and serialize generated multipart model parts as JSON blobs.
  • Preserve both startBatch REST mappings and generate collision-free TypeScript method names.
  • Regenerate openapi/openapi.yaml and the committed Angular OpenAPI client tree.
  • Adapt tutorial-group consumers to regenerated summary DTOs and deep-clone nested generated data while preserving legacy model prototypes.
  • Document Quiz as a fully generated OpenAPI module.

Generated-contract invariants:

  • 29 Quiz HTTP operations with 29 unique operation IDs.
  • 13 OpenAPI oneOf schemas with corresponding generated TypeScript union aliases.
  • No unresolved local schema references or untyped Quiz operation bodies.
  • Existing Angular Quiz call sites remain on their domain-specific facades.

Steps for Testing

Prerequisites:

  • Java 25 and Node 24 with pnpm 11.
  • A clean checkout of this branch.
  • For manual testing: 1 instructor, 1 student, and a course containing Quiz exercises with multiple-choice, drag-and-drop, and short-answer questions.

1. Regenerate and validate the API contract

  1. Run ./gradlew generateApiDocs -x webapp.
  2. Run ./gradlew openApiGenerate -x webapp.
  3. Confirm both commands exit successfully and git diff --exit-code reports no generated changes.
  4. Inspect openapi/openapi.yaml and confirm:
    • there are 29 Quiz operations with unique operationId values;
    • both batch-start paths are present;
    • all local $ref targets resolve;
    • Quiz union parents contain all three discriminator mappings;
    • QuizQuestionWithoutSolution branches do not expose explanation;
    • multipart operations use the exercise and files parts;
    • the training response still documents X-Has-Next.

2. Run server verification

  1. Run ./gradlew test --tests QuizEntityUsageArchitectureTest --tests QuizResourceArchitectureTest -x webapp.
  2. Run ./gradlew test --tests QuizExerciseIntegrationTest --tests QuizSubmissionIntegrationTest --tests QuizParticipationIntegrationTest --tests QuizQuestionProgressIntegrationTest --tests QuizTrainingLeaderboardTest --tests QuizExerciseVersionIntegrationTest -x webapp.
  3. Confirm all tests pass.

These tests cover retrieval, creation/update, batch lifecycle, participation, submission, question progress, training, leaderboard behavior, versioning, and resource architecture.

3. Compile the generated client

  1. Run pnpm run webapp:build.
  2. Confirm the Angular production build completes without TypeScript errors.

4. Verify the three student response states

  1. As an instructor, create a Quiz exercise containing all three supported question types.
  2. Before the Quiz starts, retrieve it as the student. Confirm the response contains quizQuestionsType: "before-quiz-start" and does not expose questions.
  3. Start the Quiz and let the student join. Confirm the exercise and participation responses contain quizQuestionsType: "live-quiz", include questions, and do not expose solutions.
  4. Submit answers for all three question types.
  5. End the Quiz and retrieve the exercise and participation result again. Confirm quizQuestionsType: "after-quiz-end" and that the evaluated result exposes the expected solutions and feedback.
  6. Confirm the existing Quiz UI flows remain unchanged because production call sites still use the existing Quiz facades.

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find this PR or branch, and trigger the deployment.

Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Generated OpenAPI contract and Angular client
  • Quiz student lifecycle and discriminator responses

Test Coverage

Note: Some tests in the Test job did not pass (failure). Coverage below may be partial.

Client

Class/File Line Coverage Lines Expects Ratio
calendar-api.ts not found (modified) 43 ? ?
global-search-api.ts not found (modified) 27 ? ?
hyperion-assessment-criteria-generation-api.ts not found (modified) 14 ? ?
hyperion-code-generation-api.ts not found (modified) 14 ? ?
hyperion-faq-api.ts not found (modified) 14 ? ?
hyperion-problem-statement-api.ts not found (modified) 58 ? ?
hyperion-quiz-question-generation-api.ts not found (modified) 26 ? ?
legacy-calendar-api.ts not found (modified) 23 ? ?
quiz-exercise-api.ts not found (modified) 14 ? ?
quiz-exercise-batch-api.ts not found (modified) 27 ? ?
quiz-exercise-creation-update-api.ts not found (modified) 49 ? ?
quiz-exercise-deletion-api.ts not found (modified) 12 ? ?
quiz-exercise-evaluation-api.ts not found (modified) 29 ? ?
quiz-exercise-retrieval-api.ts not found (modified) 52 ? ?
quiz-participation-api.ts not found (modified) 22 ? ?
quiz-submission-api.ts not found (modified) 33 ? ?
quiz-training-api.ts not found (modified) 56 ? ?
tutorial-group-api.ts not found (modified) 102 ? ?
tutorial-group-free-period-api.ts not found (modified) 42 ? ?
tutorial-group-session-api.ts not found (modified) 35 ? ?
tutorial-groups-configuration-api.ts not found (modified) 33 ? ?
answer-counter.ts not found (modified) 6 ? ?
answer-option-create.ts not found (modified) 6 ? ?
answer-option-from-editor.ts not found (modified) 7 ? ?
answer-option-re-evaluate.ts not found (modified) 8 ? ?
answer-option-with-solution.ts not found (modified) 8 ? ?
answer-option-without-solution.ts not found (modified) 6 ? ?
artifact-location.ts not found (modified) 15 ? ?
assessment-criteria-generation-request.ts not found (modified) 8 ? ?
assessment-criteria-generation-response.ts not found (modified) 4 ? ?
bloom-radar.ts not found (modified) 8 ? ?
calendar-event.ts not found (modified) 20 ? ?
channel-sub-type-reference-dates.ts not found (modified) 5 ? ?
channel.ts not found (modified) 43 ? ?
checklist-action-request.ts not found (modified) 12 ? ?
checklist-action-response.ts not found (modified) 5 ? ?
checklist-analysis-request.ts not found (modified) 6 ? ?
checklist-analysis-response.ts not found (modified) 10 ? ?
code-generation-job-start.ts not found (modified) 13 ? ?
code-generation-request.ts not found (modified) 15 ? ?
competency-exercise-link.ts not found (modified) 5 ? ?
competency-link.ts not found (modified) 5 ? ?
competency.ts not found (modified) 4 ? ?
consistency-check-response.ts not found (modified) 11 ? ?
consistency-issue.ts not found (modified) 25 ? ?
conversation-user.ts not found (modified) 14 ? ?
costs.ts not found (modified) 5 ? ?
course-competency.ts not found (modified) 20 ? ?
course-for-quiz-exercise.ts not found (modified) 68 ? ?
create-or-update-tutorial-group-request.ts not found (modified) 11 ? ?
create-or-update-tutorial-group-session-request.ts not found (modified) 7 ? ?
difficulty-assessment.ts not found (modified) 25 ? ?
domain-object.ts not found (modified) 3 ? ?
drag-and-drop-mapping-create.ts not found (modified) 4 ? ?
drag-and-drop-mapping-from-editor.ts not found (modified) 5 ? ?
drag-and-drop-mapping-from-live-client.ts not found (modified) 5 ? ?
drag-and-drop-mapping-re-evaluate.ts not found (modified) 4 ? ?
drag-and-drop-mapping.ts not found (modified) 10 ? ?
drag-and-drop-question-create.ts not found (modified) 29 ? ?
drag-and-drop-question-from-editor.ts not found (modified) 30 ? ?
drag-and-drop-question-re-evaluate.ts not found (modified) 29 ? ?
drag-and-drop-quiz-question-statistic.ts not found (modified) 15 ? ?
drag-and-drop-quiz-question-with-solution.ts not found (modified) 31 ? ?
drag-and-drop-quiz-question-without-solution.ts not found (modified) 28 ? ?
drag-and-drop-submitted-answer-after-evaluation.ts not found (modified) 14 ? ?
drag-and-drop-submitted-answer-before-evaluation.ts not found (modified) 13 ? ?
drag-and-drop-submitted-answer-from-live-client.ts not found (modified) 12 ? ?
drag-and-drop-submitted-answer-from-student.ts not found (modified) 11 ? ?
drag-item-create.ts not found (modified) 5 ? ?
drag-item-from-editor.ts not found (modified) 6 ? ?
drag-item-re-evaluate.ts not found (modified) 6 ? ?
drag-item.ts not found (modified) 6 ? ?
drop-location-counter.ts not found (modified) 6 ? ?
drop-location-create.ts not found (modified) 7 ? ?
drop-location-from-editor.ts not found (modified) 8 ? ?
drop-location-re-evaluate.ts not found (modified) 4 ? ?
drop-location.ts not found (modified) 8 ? ?
entity-id-ref.ts not found (modified) 3 ? ?
exam-seat.ts not found (modified) 14 ? ?
exercise-variant-group-reference.ts not found (modified) 10 ? ?
generated-assessment-criterion.ts not found (modified) 6 ? ?
generated-assessment-instruction.ts not found (modified) 7 ? ?
global-search-result.ts not found (modified) 8 ? ?
grading-criterion.ts not found (modified) 6 ? ?
grading-instruction.ts not found (modified) 8 ? ?
inferred-competency.ts not found (modified) 14 ? ?
leaderboard-entry.ts not found (modified) 13 ? ?
leaderboard-setting.ts not found (modified) 3 ? ?
leaderboard-with-current-user-entry.ts not found (modified) 7 ? ?
multiple-choice-question-create.ts not found (modified) 25 ? ?
multiple-choice-question-from-editor.ts not found (modified) 26 ? ?
multiple-choice-question-re-evaluate.ts not found (modified) 25 ? ?
multiple-choice-quiz-question-statistic.ts not found (modified) 15 ? ?
multiple-choice-quiz-question-with-solution.ts not found (modified) 27 ? ?
multiple-choice-quiz-question-without-solution.ts not found (modified) 26 ? ?
multiple-choice-submitted-answer-after-evaluation.ts not found (modified) 14 ? ?
multiple-choice-submitted-answer-before-evaluation.ts not found (modified) 13 ? ?
multiple-choice-submitted-answer-from-live-client.ts not found (modified) 11 ? ?
multiple-choice-submitted-answer-from-student.ts not found (modified) 10 ? ?
point-counter.ts not found (modified) 6 ? ?
problem-statement-generation-request.ts not found (modified) 3 ? ?
problem-statement-generation-response.ts not found (modified) 3 ? ?
problem-statement-global-refinement-request.ts not found (modified) 4 ? ?
problem-statement-refinement-response.ts not found (modified) 3 ? ?
problem-statement-rewrite-request.ts not found (modified) 3 ? ?
problem-statement-rewrite-response.ts not found (modified) 4 ? ?
problem-statement-targeted-refinement-request.ts not found (modified) 8 ? ?
quality-issue-location.ts not found (modified) 4 ? ?
quality-issue.ts not found (modified) 23 ? ?
quiz-batch-creation.ts not found (modified) 3 ? ?
quiz-batch-for-course.ts not found (modified) 7 ? ?
quiz-batch-from-editor.ts not found (modified) 5 ? ?
quiz-batch-join.ts not found (modified) 3 ? ?
quiz-batch-with-password.ts not found (modified) 7 ? ?
quiz-batch.ts not found (modified) 6 ? ?
quiz-exercise-create.ts not found (modified) 47 ? ?
quiz-exercise-dates.ts not found (modified) 5 ? ?
quiz-exercise-for-course.ts not found (modified) 31 ? ?
quiz-exercise-for-search.ts not found (modified) 9 ? ?
quiz-exercise-for-student-response.ts not found (modified) 4 ? ?
quiz-exercise-re-evaluate.ts not found (modified) 14 ? ?
quiz-exercise-with-questions-for-student.ts not found (modified) 64 ? ?
quiz-exercise-with-questions.ts not found (modified) 58 ? ?
quiz-exercise-with-solution-for-student.ts not found (modified) 64 ? ?
quiz-exercise-with-solution.ts not found (modified) 58 ? ?
quiz-exercise-with-statistics.ts not found (modified) 68 ? ?
quiz-exercise-without-questions-for-student.ts not found (modified) 62 ? ?
quiz-exercise-without-questions.ts not found (modified) 56 ? ?
quiz-point-statistic.ts not found (modified) 7 ? ?
quiz-question-bulk-refinement-request.ts not found (modified) 4 ? ?
quiz-question-bulk-refinement-response.ts not found (modified) 4 ? ?
quiz-question-create.ts not found (modified) 4 ? ?
quiz-question-from-editor.ts not found (modified) 4 ? ?
quiz-question-generation-request.ts not found (modified) 22 ? ?
quiz-question-generation-response.ts not found (modified) 3 ? ?
quiz-question-re-evaluate.ts not found (modified) 4 ? ?
quiz-question-refinement-failure.ts not found (modified) 9 ? ?
quiz-question-refinement-request.ts not found (modified) 3 ? ?
quiz-question-refinement-response.ts not found (modified) 3 ? ?
quiz-question-refinement-success.ts not found (modified) 9 ? ?
quiz-question-statistic.ts not found (modified) 4 ? ?
quiz-question-training.ts not found (modified) 8 ? ?
quiz-question-with-solution.ts not found (modified) 4 ? ?
quiz-question-with-statistics.ts not found (modified) 37 ? ?
quiz-question-without-solution.ts not found (modified) 4 ? ?
quiz-search-course.ts not found (modified) 3 ? ?
quiz-search-exam.ts not found (modified) 5 ? ?
quiz-search-exercise-group.ts not found (modified) 4 ? ?
quiz-submission-after-evaluation.ts not found (modified) 22 ? ?
quiz-submission-before-evaluation.ts not found (modified) 19 ? ?
quiz-submission-for-result.ts not found (modified) 24 ? ?
quiz-submission-from-live-client.ts not found (modified) 5 ? ?
quiz-submission-from-student.ts not found (modified) 4 ? ?
result-after-evaluation-with-submission.ts not found (modified) 18 ? ?
result-after-evaluation.ts not found (modified) 16 ? ?
rewrite-faq-request.ts not found (modified) 3 ? ?
rewrite-faq-response.ts not found (modified) 6 ? ?
search-result-page-dto-quiz-exercise-for-search.ts not found (modified) 5 ? ?
short-answer-mapping-create.ts not found (modified) 4 ? ?
short-answer-mapping-from-editor.ts not found (modified) 5 ? ?
short-answer-mapping-re-evaluate.ts not found (modified) 5 ? ?
short-answer-mapping.ts not found (modified) 10 ? ?
short-answer-question-create.ts not found (modified) 30 ? ?
short-answer-question-from-editor.ts not found (modified) 31 ? ?
short-answer-question-re-evaluate.ts not found (modified) 29 ? ?
short-answer-quiz-question-statistic.ts not found (modified) 15 ? ?
short-answer-quiz-question-with-solution.ts not found (modified) 32 ? ?
short-answer-quiz-question-without-solution.ts not found (modified) 29 ? ?
short-answer-solution-create.ts not found (modified) 4 ? ?
short-answer-solution-from-editor.ts not found (modified) 5 ? ?
short-answer-solution-re-evaluate.ts not found (modified) 6 ? ?
short-answer-solution.ts not found (modified) 5 ? ?
short-answer-spot-counter.ts not found (modified) 6 ? ?
short-answer-spot-create.ts not found (modified) 5 ? ?
short-answer-spot-from-editor.ts not found (modified) 6 ? ?
short-answer-spot-re-evaluate.ts not found (modified) 4 ? ?
short-answer-spot.ts not found (modified) 6 ? ?
short-answer-submitted-answer-after-evaluation.ts not found (modified) 14 ? ?
short-answer-submitted-answer-before-evaluation.ts not found (modified) 13 ? ?
short-answer-submitted-answer-from-live-client.ts not found (modified) 12 ? ?
short-answer-submitted-answer-from-student.ts not found (modified) 11 ? ?
short-answer-submitted-text-from-live-client.ts not found (modified) 5 ? ?
short-answer-submitted-text-from-student.ts not found (modified) 4 ? ?
short-answer-submitted-text.ts not found (modified) 6 ? ?
student-export.ts not found (modified) 5 ? ?
student-quiz-participation-with-questions.ts not found (modified) 30 ? ?
student-quiz-participation-with-solutions.ts not found (modified) 30 ? ?
student-quiz-participation-without-questions.ts not found (modified) 30 ? ?
student-quiz-participation.ts not found (modified) 4 ? ?
student.ts not found (modified) 8 ? ?
submitted-answer-after-evaluation.ts not found (modified) 4 ? ?
submitted-answer-before-evaluation.ts not found (modified) 4 ? ?
submitted-answer-from-live-client.ts not found (modified) 4 ? ?
submitted-answer-from-student.ts not found (modified) 4 ? ?
timing.ts not found (modified) 5 ? ?
tokens.ts not found (modified) 5 ? ?
tutorial-group-configuration.ts not found (modified) 9 ? ?
tutorial-group-detail-data.ts not found (modified) 17 ? ?
tutorial-group-export-data.ts not found (modified) 15 ? ?
tutorial-group-free-period-request.ts not found (modified) 5 ? ?
tutorial-group-free-period.ts not found (modified) 6 ? ?
tutorial-group-import-data.ts not found (modified) 19 ? ?
tutorial-group-schedule.ts not found (modified) 7 ? ?
tutorial-group-session.ts not found (modified) 12 ? ?
tutorial-group-student-import-data.ts not found (modified) 4 ? ?
tutorial-group-student.ts not found (modified) 8 ? ?
tutorial-group-summary-schedule.ts not found (modified) 10 ? ?
tutorial-group-summary-session.ts not found (modified) 17 ? ?
tutorial-group-summary.ts not found (modified) 24 ? ?
update-quiz-exercise.ts not found (modified) 40 ? ?
tutorial-groups-management.component.ts 92.50% 115 20 17.4
course-tutorial-groups.component.ts 88.61% 261 19 7.3
convertTutorialGroupEntityDates.ts 92.24% 181 39 21.5

Server

Class/File Line Coverage Lines
SearchTermPageableSearchDTO.java not found (modified) 13
GeneratedAssessmentCriterionDTO.java not found (modified) 14
GeneratedAssessmentInstructionDTO.java not found (modified) 14
QuizQuestionStatisticDTO.java not found (modified) 103
QuizExerciseForStudentResponseDTO.java not found (modified) 40
StudentQuizParticipationDTO.java not found (modified) 20
StudentQuizParticipationWithQuestionsDTO.java not found (modified) 34
StudentQuizParticipationWithSolutionsDTO.java not found (modified) 38
StudentQuizParticipationWithoutQuestionsDTO.java not found (modified) 34
QuizQuestionWithSolutionDTO.java not found (modified) 53
DragAndDropQuestionCreateDTO.java not found (modified) 81
MultipleChoiceQuestionCreateDTO.java not found (modified) 38
QuizQuestionCreateDTO.java not found (modified) 30
ShortAnswerQuestionCreateDTO.java not found (modified) 80
DragAndDropQuestionFromEditorDTO.java not found (modified) 74
MultipleChoiceQuestionFromEditorDTO.java not found (modified) 42
QuizQuestionFromEditorDTO.java not found (modified) 31
ShortAnswerQuestionFromEditorDTO.java not found (modified) 76
DragAndDropQuestionReEvaluateDTO.java not found (modified) 25
MultipleChoiceQuestionReEvaluateDTO.java not found (modified) 22
QuizQuestionReEvaluateDTO.java not found (modified) 27
ShortAnswerQuestionReEvaluateDTO.java not found (modified) 41
SubmittedAnswerAfterEvaluationDTO.java not found (modified) 53
SubmittedAnswerFromStudentDTO.java not found (modified) 42
QuizExerciseService.java not found (modified) 1025
QuizExerciseRetrievalResource.java not found (modified) 177

Last updated: 2026-08-24 00:48:56 UTC

@github-project-automation github-project-automation Bot moved this to Work In Progress in Artemis Development Aug 21, 2026
@github-actions github-actions Bot added tests server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) documentation core Pull requests that affect the corresponding module quiz Pull requests that affect the corresponding module tutorialgroup Pull requests that affect the corresponding module labels Aug 21, 2026
@Nihad74 Nihad74 changed the title : Add quiz endpoints to the generated API contract Development: Add quiz endpoints to the generated API contract Aug 21, 2026
@Nihad74
Nihad74 force-pushed the feature/quiz-exercises/integrate-quiz-openapi-generation branch from 7487c79 to fda7e93 Compare August 22, 2026 00:17
@Nihad74
Nihad74 had a problem deploying to playwright-e2e-tests August 22, 2026 00:29 — with GitHub Actions Error
@Nihad74 Nihad74 changed the title Development: Add quiz endpoints to the generated API contract Quiz exercises: Add quiz endpoints to the generated API contract Aug 22, 2026
@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown

End-to-End Test Results

Phase Status Details
All Tests ❌ Failed
TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
All E2E Tests Report (PR)372 ran363 passed7 skipped2 failed38m 1s
❌ Failed Tests
  • Exam PlantUML diagram isolation › PlantUML diagrams survive navigating back and forth and rapid switching (3m 46s)
  • Exam submission recovery after a failed save › restores and re-sends a not-yet-saved quiz answer after a failed save and reload (4m 54s)

Test Strategy: Running all tests (configuration or infrastructure changes detected)

Overall: ❌ E2E: real (non-flaky) test failure

🔗 Workflow Run · 📊 Test Report

@Nihad74
Nihad74 temporarily deployed to playwright-e2e-tests August 22, 2026 00:53 — with GitHub Actions Inactive
@Nihad74
Nihad74 marked this pull request as ready for review August 23, 2026 23:29
@Nihad74
Nihad74 requested review from a team and krusche as code owners August 23, 2026 23:29
@Nihad74
Nihad74 had a problem deploying to playwright-e2e-tests August 23, 2026 23:37 — with GitHub Actions Error
@Nihad74
Nihad74 temporarily deployed to playwright-e2e-tests August 24, 2026 00:26 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Pull requests that update TypeScript code. (Added Automatically!) core Pull requests that affect the corresponding module course documentation hyperion quiz Pull requests that affect the corresponding module ready for review server Pull requests that update Java code. (Added Automatically!) tests tutorialgroup Pull requests that affect the corresponding module

Projects

Status: Work In Progress

Development

Successfully merging this pull request may close these issues.

1 participant