Skip to content

fix: ensure leading blanks are always imported - #434

Merged
allanbowe merged 4 commits into
mainfrom
leadblanks
Jul 22, 2026
Merged

fix: ensure leading blanks are always imported #434
allanbowe merged 4 commits into
mainfrom
leadblanks

Conversation

@allanbowe

@allanbowe allanbowe commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

Fixes two cases where leading blanks in character data were silently stripped during web service input/output, and relaxes an over-strict test assertion.

Changes

meta/mm_createwebservice.sas & server/ms_createwebservice.sas

  1. JSON export now retains leading blanks
    Previously, non-special character values were exported using quote(cats(...)), which strips leading blanks. Replaced with '"'!!trim(...)!!'"' so leading blanks are preserved while trailing blanks are still trimmed.

  2. Table imports now use $char informat
    The generated input statement used a plain $ informat, which strips leading blanks on import. A prxchange now rewrites :$ informats to :$char in the captured input statement, ensuring leading blanks in incoming data are retained.

tests/base/mp_jsonout.test.3.sas

  • The assertion masks SYSINFO with band(&sysinfo, 64+128+4096+32768) (stored in sysinfo_masked, as SYSINFO is read-only) so only data-related differences fail the test:
    • 64 — base dataset has observation not in comparison
    • 128 — comparison dataset has observation not in base
    • 4096 — a value comparison was unequal
    • 32768 — number of observations differ

Verification

  • mp_jsonout.test.3 now passes (JSON round trip identical for all special chars, including leading/trailing blank variants)
  • sasjs lint passes clean

@allanbowe allanbowe changed the title Leadblanks fix: ensure leading blanks are always imported Jul 22, 2026
@allanbowe

Copy link
Copy Markdown
Member Author

Test results:

ℹ Tests provided results: 125/125 (100%)
ℹ Tests that pass: 125/125 (100%)

@allanbowe
allanbowe merged commit 4e5c6e8 into main Jul 22, 2026
2 checks passed
@allanbowe
allanbowe deleted the leadblanks branch July 22, 2026 17:04
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.68.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant