event-catalog / event-catalog/generators

OpenAPI: A service with no path to openapi contracts is not generated

Open
#423 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
15
Forks
16
Avg merge
25m
Merged PRs (30d)
4

Description

### I tried this:

When i have a service configured to be generated with OpenAPI generator which has no path to an openapi contract the service is not generated.

I have a service which only consumes OpenAPI and does not provide a Rest interface is not generated.
```
[
'@eventcatalog/generator-openapi',
{
domain: {id: 'MyDomain', name: 'My Domain', version: '0.0.0'},
saveParsedSpecFile: true,
parseChannels: true,
debug: true,
services: [
{
id: 'my-only-consuming-openapi-service',
consumers: [
{id: 'other-providing-service'}
]
},
}
]
```

### This happened:

The service is not generated with the following error during `npm run generate` :
```
Failed to parse OpenAPI file: undefined
TypeError: Cannot read properties of undefined (reading 'startsWith')
```

### I expected this:

I would expect the service always to be generated, even if it does not proivide and does not consume any openapi contract.
The existance of a service should not be dependent on a contract.

### Is there a workaround?

There's no workaroud

### Anything else?

_No response_

### EventCatalog Version

"@eventcatalog/core": "4.3.4", "@eventcatalog/generator-openapi": "9.0.0",

### Node.js Version

v22.22.0

### Platform(s)

Linux

### Community Notes

* Please vote by adding a 👍 reaction to the issue to help us prioritize.
* If you are interested to work on this issue, please leave a comment.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with the shown generator-openapi configuration and npm run generate. Trace service generation when no OpenAPI contract path is provided, focusing on the undefined startsWith error. Done means the consuming-only service is generated successfully without an OpenAPI contract.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.