Skip to content

feat: classical HttpClient GET methods + generation fixes (1.1.0)#7

Merged
krusche merged 3 commits into
mainfrom
feat/classical-http-get-and-generation-fixes
Jul 7, 2026
Merged

feat: classical HttpClient GET methods + generation fixes (1.1.0)#7
krusche merged 3 commits into
mainfrom
feat/classical-http-get-and-generation-fixes

Conversation

@krusche

@krusche krusche commented Jun 30, 2026

Copy link
Copy Markdown
Member

Summary

Makes the classical (non-httpResource) generation mode usable and fixes several code-generation bugs discovered while adopting this generator for the Artemis OpenAPI client. Switches publishing to Maven Central and bumps the version to 1.1.0.

Changes

  • Classical HttpClient.get() GET methods (useHttpResource=false): GET operations are now emitted as classical Observable methods in the API service. Previously every operation in api-service.mustache was wrapped in {{^vendorExtensions.x-is-get}}, so GETs were only ever produced via the httpResource resource template — disabling useHttpResource silently dropped all GET endpoints. GET-only tags now also keep their -api.ts file in classical mode.
  • Relative model imports: model-to-model imports are now './other-model' instead of the bare 'other-model', which did not resolve.
  • Observable<void>: operations always emit an explicit response type parameter, so void endpoints return Observable<void> instead of Observable<Object>.
  • Mutation body argument: POST/PUT/PATCH always pass a body argument (HttpClient requires it; a missing body produced a TS "Expected 2–3 arguments" error).
  • Path-parameter interpolation: non-numeric path params are interpolated as ${param} instead of the literal text {param}; numeric params no longer get a doubled $.
  • Array-of-enum properties: wrapped in Array<…> instead of a single enum type.
  • Build against openapi-generator 7.21.0 (aligned with the org.openapi.generator Gradle plugin version used downstream in Artemis).
  • Publish to Maven Central: replaces GitHub Packages publishing (which requires authentication even to download) with the Sonatype Central Portal via the com.vanniktech.maven.publish plugin, so consumers resolve the generator from a plain mavenCentral() with no auth. Artifacts are GPG-signed, gated on a key being present so publishToMavenLocal still works key-free. Adds RELEASING.md.

Context

These fixes are required for the Artemis client to compile and run after switching its OpenAPI client to this generator (Artemis PR ls1intum/Artemis#13038). Configured there with useHttpResource=false, useInjectFunction=true, separateResources=false, readonlyModels=false.

Releasing 1.1.0 (maintainers)

Publishing now targets Maven Central (auth-free for consumers). One-time setup — see RELEASING.md:

  1. Claim the de.tum.cit.aet namespace on central.sonatype.com (verify tum.de via a DNS TXT record).
  2. Generate a Central Portal user token and a GPG signing key (publish the public key to a keyserver).
  3. Add four repo secrets: MAVEN_CENTRAL_USERNAME, MAVEN_CENTRAL_PASSWORD, SIGNING_KEY (ASCII-armored private key), SIGNING_PASSWORD.

Then release by pushing a tag: git tag v1.1.0 && git push origin v1.1.0 — the workflow signs and uploads to the Central Portal and creates a GitHub Release.

Make the classical (non-httpResource) mode usable and fix several code-generation
bugs surfaced when adopting the generator in Artemis:

- useHttpResource=false now emits classical Observable HttpClient.get() methods in
  the API service. Previously GET operations were always excluded from the service
  ({{^x-is-get}}) and only emitted via the httpResource template, so disabling
  httpResource silently dropped every GET endpoint. GET-only tags now also keep
  their -api.ts file in classical mode.
- Model-to-model imports are now relative ('./other-model' instead of bare
  'other-model'), which did not resolve.
- Operations always emit an explicit response type parameter, so void endpoints
  return Observable<void> instead of Observable<Object>.
- POST/PUT/PATCH always pass a body argument (HttpClient requires it; a missing
  body produced a TS "expected 2-3 arguments" error).
- Non-numeric path parameters are interpolated (\${param}) instead of being
  emitted as the literal text {param}, and numeric params no longer get a doubled $.
- Array-of-enum model properties are wrapped in Array<...> instead of a single enum.
- Build against openapi-generator 7.21.0 (aligned with the org.openapi.generator
  Gradle plugin used downstream).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 30, 2026 11:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

krusche added a commit to ls1intum/Artemis that referenced this pull request Jun 30, 2026
…cation

Bump to de.tum.cit.aet:openapi-generator-angular21:1.1.0 — the upstreamed version
with the classical-GET support and generation fixes
(ls1intum/openapi-generator-angular22#7) — and resolve it (for the openApiGenerate
task only) from Maven Local (build-from-source) or GitHub Packages (with a
read:packages token, provided automatically in CI). This lets anyone regenerate the
client, not just from a local-only publish. The generated client stays committed,
so CI never runs openApiGenerate and never resolves the generator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
krusche and others added 2 commits June 30, 2026 14:31
Replace GitHub Packages publishing (which requires authentication even to
*download*, so it is poor for general consumption) with the Sonatype Central
Portal via the com.vanniktech.maven.publish plugin. Consumers now resolve the
generator from a plain mavenCentral() repository with no auth.

- Sign all publications with GPG, gated on a key being present so that
  `publishToMavenLocal` (build-from-source) still works without a key.
- Update the release workflow to upload to the Central Portal on a v* tag.
- Add RELEASING.md documenting the one-time namespace/token/signing-key setup
  and the tag-based release procedure.
- Bump README install/version references to 1.1.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
GET operations returning text or binary payloads were generated as
http.get<string>(url) / http.get<Blob>(url) with no responseType, so Angular's
HttpClient defaulted to responseType 'json' and threw while JSON-parsing iCalendar
files, CSV exports, and plain-text tokens.

Compute an x-response-type vendor extension: 'blob' for Blob returns, 'text' for
string returns whose produced media types are all text/* (JSON-string endpoints,
which produce application/json, keep the default parser). The template then emits
http.get(url, { responseType: 'text' | 'blob' }), whose overloads already return
Observable<string> / Observable<Blob>, so the declared return type is preserved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@krusche
krusche merged commit 423b3a9 into main Jul 7, 2026
2 checks passed
@az108 az108 mentioned this pull request Jul 7, 2026
10 tasks
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