vault/ui/docs/serializers-adapters.md
claire bontempo ea292e8142
Ui: Add contributing pattern doc (#19897)
* format readme to prepare for pattern info

* small text changes

* add markdown files for each section

* readme updates

* routing md draft

* add table of contents

* add oidc pr sample

* update routing

* add decorator section

* serializer docs

* add table of contents

* update readme

* add title

* add decorator section

* models readme

* update comments

* modify examples

* add bullets and more comments

* what the heck fix bullet

* model docs

* form docs

* routing doc

* serializer/adapter

* adds docs for model-validations decorator (#20596)

* UI Docs: Components (#20602)

* Add CSS best practices (#20370)

* wip--saving work

* wip

* friday morning....

* update

* fix exists to exist

* one more change

* UI docs: Add ember engine creation documentation (#20789)

---------

Co-authored-by: Jordan Reimer <zofskeez@gmail.com>
Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>
Co-authored-by: Angel Garbarino <Monkeychip@users.noreply.github.com>
Co-authored-by: Kianna <30884335+kiannaquach@users.noreply.github.com>
2023-05-30 10:24:35 -07:00

1.2 KiB

Serializers & Adapters

Guidelines

  • Prepend internal functions with an underscore to differentiate from Ember methods _getUrl
  • Consider using the named-path adapter if the model name is part of the request path
  • Utilize the serializer to remove sending model attributes that do not correspond to an API parameter. Example in key serializer
export default class SomeSerializer extends ApplicationSerializer {
  attrs = {
    attrName: { serialize: false },
  };
}

Note: this will remove the attribute when calling snapshot.serialize() even if the method is called within the serialize method where custom logic may be written

Gotchas