Skip to content

Fix displaycollectionname pluralization - #196

Open
David (MrPoopey) wants to merge 5 commits into
microsoft:mainfrom
MrPoopey:fix/166-displaycollectionname-pluralization
Open

David (MrPoopey) wants to merge 5 commits into
microsoft:mainfrom
MrPoopey:fix/166-displaycollectionname-pluralization

Conversation

@MrPoopey

Copy link
Copy Markdown
  • Replace display_name + "s" with an inflect based pluralization (_pluralize / _inflect_word in _odata_base.py
  • Applied it at all payload building sites (_create_entity, async _create_entity, _build_create_entity)
  • Added inflect>=7.0 dependency
David (MrPoopey) and others added 2 commits August 24, 2026 21:03
Replace the `display_name + "s"` pattern with a proper English
pluralization helper backed by `inflect`, so table display collection
names like "Category" → "Categories" and "Person" → "People" instead
of "Categorys" / "Persons".

Adds `_inflect_word` and `_pluralize` module-level helpers in
`_odata_base.py` and applies them in all three payload-building sites
(sync `_create_entity`, async `_create_entity`, `_build_create_entity`).
Adds `inflect>=7.0` as a runtime dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move the inflect import out of the stdlib block into its own
third-party group so import ordering matches isort conventions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DGxSCE1DfVPV6rULqYruod
Copilot AI lite review requested due to automatic review settings August 24, 2026 14:34
@MrPoopey
David (MrPoopey) requested a review from a team as a code owner August 24, 2026 14:34
@MrPoopey David (MrPoopey) changed the title Fix/166 displaycollectionname pluralization Aug 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR replaces naive collection-name suffixing with inflect-based pluralization for Dataverse table creation.

Changes:

  • Applies pluralization to synchronous, asynchronous, and batch payloads.
  • Adds shared helpers, tests, the inflect dependency, and a changelog entry.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Summary
tests/unit/data/test_odata_internal.py Adds synchronous pluralization tests.
tests/unit/aio/data/test_async_odata_internal.py Adds asynchronous table-creation tests.
src/PowerPlatform/Dataverse/data/_odata.py Updates synchronous creation payloads.
src/PowerPlatform/Dataverse/data/_odata_base.py Adds shared pluralization and batch payload logic. Two unresolved moderate findings concern preserving casing and handling surrounding whitespace.
src/PowerPlatform/Dataverse/aio/data/_async_odata.py Updates asynchronous creation payloads.
pyproject.toml Adds the inflect dependency.
CHANGELOG.md Documents the pluralization change.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

David (MrPoopey) and others added 2 commits August 25, 2026 00:46
inflect lowercases-then-recapitalizes-first-letter collapsed internal
PascalCase, e.g. "new_TestTable" -> "new_Testtables" instead of
"new_TestTables". Splice the pluralized suffix onto the original-cased
word at the point where the lowercased singular/plural diverge, so
casing is preserved throughout, not just at the first character.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDFa5teWvWjVLC6aJnqpEu
…crosoft#166)

_build_create_entity validated display_name with .strip() but used the
raw (unstripped) value to build DisplayName/DisplayCollectionName. A
trailing space (e.g. "Product ") made _pluralize's last split() token
empty, so the collection name was sent un-pluralized and padded
instead of "Products". Strip the value once it passes validation so it
flows correctly into DisplayName, DisplayCollectionName, and
Description.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDFa5teWvWjVLC6aJnqpEu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants