Skip to content

[legacy-framework] Fixes field names being modified during model generation #708

Merged
aem merged 5 commits intoblitz-js:canaryfrom
toshi1127:fix/issue-696
Jun 22, 2020
Merged

[legacy-framework] Fixes field names being modified during model generation #708
aem merged 5 commits intoblitz-js:canaryfrom
toshi1127:fix/issue-696

Conversation

@toshi1127
Copy link
Collaborator

@toshi1127 toshi1127 commented Jun 20, 2020

This PR closes the issue of Prevent automatic conversion of field names. blitz-js/legacy-framework#923

What are the changes and their implications?

  • Prevent automatic conversion of field names.

Checklist

  • Tests added for changes
  • PR submitted to blitzjs.com for any user facing changes

@toshi1127 toshi1127 requested a review from aem as a code owner June 20, 2020 19:38
@toshi1127
Copy link
Collaborator Author

Should I fix the list so that it doesn't also auto-convert to plural form?

  it("pluralizes lists and makes single fields singular", () => {
    expect(Field.parse("userIds:string[]").toString()).toEqual(
      Field.parse("userId:string[]").toString(),
    )
  })

@aem
Copy link
Collaborator

aem commented Jun 20, 2020

@toshi1127 yeah that would be great! Thanks so much for tackling this

@toshi1127 toshi1127 changed the title Prevent automatic conversion of field names to singular Prevent automatic conversion of field names Jun 21, 2020
expect(Field.parse("userIds:string[]").toString()).toEqual(
Field.parse("userId:string[]").toString(),
)
expect(Field.parse("user:int[]").toString()).toMatchInlineSnapshot(`"user Int[]"`)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Prevent field name from being converted to plural forms when creating a Field with a list type property.

@@ -62,21 +60,21 @@ describe("Field model", () => {

it("handles hasOne relations", () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Prevent automatic conversion of field name when creating a Field with relationships, such as hasOne.

@flybayer
Copy link
Member

@aem this is ready for final review

@aem aem merged commit 8ecdc32 into blitz-js:canary Jun 22, 2020
@aem aem changed the title Prevent automatic conversion of field names Fixes field names being modified during model generation Jun 22, 2020
@itsdillon itsdillon changed the title Fixes field names being modified during model generation [legacy-framework] Fixes field names being modified during model generation Jul 7, 2022
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.

3 participants