Skip to content

Comments

feat!: release v6#2362

Draft
jonaslagoni wants to merge 34 commits intomasterfrom
next
Draft

feat!: release v6#2362
jonaslagoni wants to merge 34 commits intomasterfrom
next

Conversation

@jonaslagoni
Copy link
Member

@jonaslagoni jonaslagoni commented Nov 4, 2025

Placeholder for v6 release

@netlify
Copy link

netlify bot commented Nov 4, 2025

Deploy Preview for modelina canceled.

Name Link
🔨 Latest commit a394ddf
🔍 Latest deploy log https://app.netlify.com/projects/modelina/deploys/699ca11c5f0d7900086d77b0

asyncapi-bot and others added 4 commits November 5, 2025 18:27
feat: support non-object model types for rust

Those model types are common when using GET parameters in an OpenAPI
document.

Typescript already has a TypeRenderer. This adds an equivalent for Rust.
However, instead of using a Rust type aliases, this PR uses the New Type
Idiom. There are two main advantages to using the New Type idiom:
compile-time value type validation and a bypass of the rust orphan rule
(see https://effective-rust.com/newtype.html).

The second advantage will be needed to implement model validation.
Likely this validation will come from an external trait.
Rust only allows adding external trait implementations to types that are
internal to the crate (type aliases do not count).
Comment on lines +584 to +587
const sanitized = schemaId
.replace('<', '')
.replace(/-/g, '_')
.replace('>', '');

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of '>'.

Copilot Autofix

AI 5 days ago

Generally, the fix is to avoid using string.replace('<', '') / string.replace('>', ''), since these only affect the first match. Instead, use a regular expression with the global (g) flag so that all occurrences are removed (or use a single regex that strips all undesired characters at once). This ensures the sanitization is complete and predictable.

The best minimal change without altering existing functionality is to update the “sanitized anonymous ID” computation so that it removes all < and > characters, and continues to replace all - characters with _. We can do this in one of two ways:

  • Keep the chaining, but switch to regexes with g:
    schemaId.replace(/</g, '').replace(/-/g, '_').replace(/>/g, ''), or
  • Use a single regex that removes all < and > and then replace dashes:
    schemaId.replace(/[<>]/g, '').replace(/-/g, '_').

Either approach is fine; the latter is slightly cleaner. No new imports or external libraries are needed; this uses built-in JavaScript/TypeScript regex support. The change is confined to the block starting at line 594 (the “Priority 7: Fallback to sanitized anonymous ID” section) in src/processors/AsyncAPIInputProcessor.ts, updating only the const sanitized = ... line.

Suggested changeset 1
src/processors/AsyncAPIInputProcessor.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/processors/AsyncAPIInputProcessor.ts b/src/processors/AsyncAPIInputProcessor.ts
--- a/src/processors/AsyncAPIInputProcessor.ts
+++ b/src/processors/AsyncAPIInputProcessor.ts
@@ -593,9 +593,8 @@
     // Priority 7: Fallback to sanitized anonymous ID
     if (schemaId?.includes(AsyncAPIInputProcessor.ANONYMOUS_PREFIX)) {
       const sanitized = schemaId
-        .replace('<', '')
-        .replace(/-/g, '_')
-        .replace('>', '');
+        .replace(/[<>]/g, '')
+        .replace(/-/g, '_');
       Logger.debug(`Using sanitized anonymous ID: ${sanitized}`);
       return sanitized;
     }
EOF
@@ -593,9 +593,8 @@
// Priority 7: Fallback to sanitized anonymous ID
if (schemaId?.includes(AsyncAPIInputProcessor.ANONYMOUS_PREFIX)) {
const sanitized = schemaId
.replace('<', '')
.replace(/-/g, '_')
.replace('>', '');
.replace(/[<>]/g, '')
.replace(/-/g, '_');
Logger.debug(`Using sanitized anonymous ID: ${sanitized}`);
return sanitized;
}
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +584 to +585
const sanitized = schemaId
.replace('<', '')

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of '<'.

Copilot Autofix

AI 5 days ago

In general, when performing string-based sanitization, avoid str.replace('x', 'y') with a plain string search, since it affects only the first occurrence. Use a regular expression with the g flag (e.g. /</g) or chain multiple replace calls that each use global regexes, so that all occurrences are processed consistently.

For this specific code, we should update the sanitization of schemaId in the “Priority 7: Fallback to sanitized anonymous ID” block to replace all < and > characters, not just the first one. The safest, minimal change that preserves existing intent is to convert the first and last .replace calls from string patterns to global regular expressions:

const sanitized = schemaId
  .replace(/</g, '')
  .replace(/-/g, '_')
  .replace(/>/g, '');

This keeps the behavior identical for IDs with at most one < or >, and correctly handles those with multiple such characters. No new imports or helpers are required; the change is limited to the sanitization expression inside src/processors/AsyncAPIInputProcessor.ts around lines 594–599.

Suggested changeset 1
src/processors/AsyncAPIInputProcessor.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/processors/AsyncAPIInputProcessor.ts b/src/processors/AsyncAPIInputProcessor.ts
--- a/src/processors/AsyncAPIInputProcessor.ts
+++ b/src/processors/AsyncAPIInputProcessor.ts
@@ -593,9 +593,9 @@
     // Priority 7: Fallback to sanitized anonymous ID
     if (schemaId?.includes(AsyncAPIInputProcessor.ANONYMOUS_PREFIX)) {
       const sanitized = schemaId
-        .replace('<', '')
+        .replace(/</g, '')
         .replace(/-/g, '_')
-        .replace('>', '');
+        .replace(/>/g, '');
       Logger.debug(`Using sanitized anonymous ID: ${sanitized}`);
       return sanitized;
     }
EOF
@@ -593,9 +593,9 @@
// Priority 7: Fallback to sanitized anonymous ID
if (schemaId?.includes(AsyncAPIInputProcessor.ANONYMOUS_PREFIX)) {
const sanitized = schemaId
.replace('<', '')
.replace(/</g, '')
.replace(/-/g, '_')
.replace('>', '');
.replace(/>/g, '');
Logger.debug(`Using sanitized anonymous ID: ${sanitized}`);
return sanitized;
}
Copilot is powered by AI and may make mistakes. Always verify output.
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 6.0.0-next.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sonarqubecloud
Copy link

Comment on lines +12 to +36
test:
name: Runtime testing Go Models
if: "github.event.pull_request.draft == false &&!((github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'ci: update global workflows')) || (github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'chore(release):')) || (github.actor == 'allcontributors' && startsWith(github.event.pull_request.title, 'docs: add')))"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check package-lock version
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
id: lockversion
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ steps.lockversion.outputs.version }}"
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Build Library
run: npm install && npm run build:prod
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Generate Go Models
run: npm run generate:runtime:go
- name: Run runtime Tests

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 15 days ago

In general, the fix is to explicitly declare a permissions block in the workflow (at the root level or per job) that grants only the scopes required. This workflow just checks out code and runs Node.js and Go commands, so it only needs read access to repository contents; no write scopes are required.

The best fix with minimal functional impact is to add a root-level permissions block directly under the name: declaration so it applies to all jobs. In .github/workflows/runtime-go-testing.yml, add:

permissions:
  contents: read

on new lines after line 1 (name: Runtime Testing Go Models). No other changes, imports, or additional configuration are needed.

Suggested changeset 1
.github/workflows/runtime-go-testing.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/runtime-go-testing.yml b/.github/workflows/runtime-go-testing.yml
--- a/.github/workflows/runtime-go-testing.yml
+++ b/.github/workflows/runtime-go-testing.yml
@@ -1,4 +1,6 @@
 name: Runtime Testing Go Models
+permissions:
+  contents: read
 on:
   push:
   pull_request:
EOF
@@ -1,4 +1,6 @@
name: Runtime Testing Go Models
permissions:
contents: read
on:
push:
pull_request:
Copilot is powered by AI and may make mistakes. Always verify output.
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 6.0.0-next.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 6.0.0-next.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 6.0.0-next.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

asyncapi-bot and others added 2 commits February 22, 2026 21:45
* test: add failing tests for date unmarshal conversion (Phase 1 - TDD RED)

Add unit tests that verify date-formatted string properties should be
converted to Date objects in the unmarshal method. These tests currently
fail because the date conversion is not yet implemented.

Test cases:
- date-time format generates new Date() conversion
- date format generates new Date() conversion
- time format generates new Date() conversion
- null safety check with ternary pattern
- regular strings remain unchanged (regression test)

Relates to: GH-2457

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(typescript): convert date-formatted strings to Date objects in unmarshal (Phase 2 - TDD GREEN)

Add date conversion logic in renderUnmarshalProperty() for ConstrainedStringModel
with format in ['date', 'date-time', 'time']. The generated unmarshal code now
includes null-safe Date conversion:

  obj["createdAt"] == null ? null : new Date(obj["createdAt"])

This fixes the type mismatch where properties declared as Date were assigned
raw strings at runtime.

Fixes: GH-2457

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* test(runtime): add Date object verification tests for unmarshal (Phase 3)

Add runtime tests that verify:
- unmarshal converts date-formatted strings to Date objects
- Date.toISOString() returns the correct value after round-trip
- null date values are handled gracefully (not converted to Invalid Date)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 6.0.0-next.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 6.0.0-next.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

4 participants