feat!: no longer sanitize collection slugs to kebab case (#1607)

BREAKING CHANGE: collection slugs are no longer automatically sanitized to be kebab case. This will only be an issue if your current slugs were in camel case. The upgrade path will be to change those slugs to the kebab case version that the slug was automatically being sanitized to on the backend.

If you only use kebab case or single word slugs: no action needed.

If you have existing slugs with camel case and populated data: you'll need to convert these to the kebab case version to match the previously sanitized value.

ie. myOldSlug is your slug, you should convert it to my-old-slug.

Any future slugs after updating will be used as-is.
This commit is contained in:
Elliot DeNolf
2022-12-09 09:40:05 -05:00
committed by GitHub
parent 7777d11b9e
commit ba2f2d6e9b

View File

@@ -2,7 +2,6 @@ import merge from 'deepmerge';
import { isPlainObject } from 'is-plain-object';
import { SanitizedCollectionConfig, CollectionConfig } from './types';
import sanitizeFields from '../../fields/config/sanitize';
import toKebabCase from '../../utilities/toKebabCase';
import baseAuthFields from '../../auth/baseFields/auth';
import baseAPIKeyFields from '../../auth/baseFields/apiKey';
import baseVerificationFields from '../../auth/baseFields/verification';
@@ -25,7 +24,6 @@ const sanitizeCollection = (config: Config, collection: CollectionConfig): Sanit
isMergeableObject: isPlainObject,
});
sanitized.slug = toKebabCase(sanitized.slug);
sanitized.labels = sanitized.labels || formatLabels(sanitized.slug);
if (sanitized.versions) {