Skip to content

Commit b945fd4

Browse files
authored
fix: retain url with next schema log if omitted during publish (#6694)
1 parent 422a7dc commit b945fd4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/services/api/src/modules/schema/providers/schema-publisher.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,17 +1910,28 @@ export class SchemaPublisher {
19101910

19111911
this.logger.debug(`Assigning ${schemaLogIds.length} schemas to new version`);
19121912

1913+
const serviceName = input.service;
1914+
let serviceUrl = input.url;
1915+
1916+
if (
1917+
(project.type === ProjectType.FEDERATION || project.type === ProjectType.STITCHING) &&
1918+
serviceUrl == null &&
1919+
pushedSchema.kind === 'composite'
1920+
) {
1921+
serviceUrl = pushedSchema.service_url;
1922+
}
1923+
19131924
const schemaVersion = await this.schemaManager.createVersion({
19141925
valid: composable,
19151926
organizationId: organizationId,
19161927
projectId: project.id,
19171928
targetId: target.id,
19181929
commit: input.commit,
19191930
logIds: schemaLogIds,
1920-
service: input.service,
19211931
schema: input.sdl,
19221932
author: input.author,
1923-
url: input.url,
1933+
service: serviceName,
1934+
url: serviceUrl,
19241935
base_schema: baseSchema,
19251936
metadata: input.metadata ?? null,
19261937
projectType: project.type,

0 commit comments

Comments
 (0)