kontent-ai / model-generator-js

MIT License
13 stars 9 forks source link

ContentTypeSnippets with LinkedItems wrongly import ContentTypes #28

Closed cwaespi closed 2 years ago

cwaespi commented 2 years ago

Brief bug description

Since splitting the ContentTypeSnippets in #25, the ContentTypes are imported incorrectly inside ContentTypeSnippets.

Repro steps

  1. Generate models
  2. have a look into folder GENERATED/content-type-snippets/ANY-SNIPPET.ts
  3. Wrong relative import of ContentType

Expected behavior

Should correctly import ContentTypes if needed.

Test environment

Additional context

Example of generated ContentTypeSnippet, relative import should look as follows:

import { IContentItem, Elements } from '@kontent-ai/delivery-sdk';

--import { SectionContent } from './section_content';
++import { SectionContent } from '../content-types/section_content';

/**
 * Generated by '@kontent-ai/model-generator@5.4.1' at 'Tue, 16 Aug 2022 13:27:01 GMT'
 *
 * Snippet - Section
 * Id: 70987e02-1761-4957-814d-4bf3d93109da
 * Codename: snippet_section
 */
export type SnippetSection = IContentItem<{
  /**
   * Section (modular_content)
   * Required: false
   * Id: 72dc987c-0b17-4873-85d9-ad1fb2bbb6f3
   * Codename: snippet_section__section
   */
  snippet_section__section: Elements.LinkedItemsElement<SectionContent>;
}>;

Screenshots

Add links to screenshots, if possible.

cwaespi commented 2 years ago

fixed in 5.5.1, thank you