Skip to content

feat: openapi angular client - #1328

Draft
b0ink wants to merge 1 commit into
doubtfire-lms:11.0.xfrom
b0ink:feat/openapi-angular-client
Draft

b0ink wants to merge 1 commit into
doubtfire-lms:11.0.xfrom
b0ink:feat/openapi-angular-client

Conversation

@b0ink

@b0ink b0ink commented Jul 2, 2026

Copy link
Copy Markdown
Member

this would move away from the ngx-entity-service

  1. Ensure container has java dependancies
sudo apt install default-jdk
  1. Generate the Angular interfaces anytime the backend has scheme changes or a new endpoint is exposed
npx openapi-generator-cli generate \
-i http://localhost:3000/api/swagger_doc.json \
-g typescript-angular \
-o ./src/app/api/generated

as long as the backend correctly exposes entities via swagger:

  desc 'Download the tasks that should be listed under the task inbox',
       success: Entities::InboxTaskEntity,
       is_array: true
  params do
    optional :my_students_only, type: Boolean, desc: 'Show tasks from all tutorials or just the ones you teach'
  end
  get '/units/:id/tasks/inbox' do
...
  present unit.tasks_as_hash(tasks), with: Entities::InboxTaskEntity

then openapi will generate the interfaces

would still need to find a way to link relationships like a task->project->unit

  1. Inject services and call auto-generated methods
 tasks = signal < InboxTaskEntity[] > ([]);
 #unitService = inject(UnitsService);

 ngOnInit(): void {
     this.authService.afterAuthCall(() => {
         const user = this.userService.currentUser;
         this.#unitService
             .getApiUnitsIdTasksInbox(1, user.username, user.authenticationToken)
             .subscribe((tasks) => this.tasks.set(tasks));
     });
 }

but this will force the backend's schema (entities) to be more consistent.

doubtfire-lms/doubtfire-api#643

This branch has not been deployed

No deployments
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