event-catalog / eventcatalog

An open source documentation tool to bring discoverability to your event-driven architectures
https://eventcatalog.dev
MIT License
1.75k stars 150 forks source link

fix(core): sidebar configuration for section visibility is now optional #610

Closed Laupetin closed 3 months ago

Laupetin commented 3 months ago

Motivation

Trying to build eventcatalog without having values for docs.sidebar.{domains,services,messages,teams,users} set will result in an error:

src/components/DocsNavigation.astro:23:28 - error ts(2352): Conversion of type '{ title: string; trailingSlash: boolean; tagline: string; organizationName: string; homepageLink: string; editUrl: string; logo: { alt: string; src: string; text: string; }; docs: { sidebar: { showPageHeadings: boolean; }; }; }' to type 'CatalogConfig' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  The types of 'docs.sidebar' are incompatible between these types.

23 const eventCatalogConfig = config as CatalogConfig;
                              ~~~~~~~~~~~~~~~~~~~~~~~

Result (95 files): 
- 1 error

Changing the values in the eventcatalog.config.js to something like:

docs: {
  sidebar: {
    // Should the sub heading be rendered in the docs sidebar?
    showPageHeadings: true,
    domains: {},
    services: {},
    messages: {},
    teams: {},
    users: {},
  }
}

will make it build again.

However these config values should most likely be optional and not required since the template eventcatalog.config.js does not include them either.

changeset-bot[bot] commented 3 months ago

⚠️ No Changeset found

Latest commit: 00c1353138089217b3c180c5c757ff4d992208b4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

boyney123 commented 3 months ago

Thanks, makes sense to me!