Skip to content

Commit

Permalink
Indicate an initial version in Mutation.schemaCheck (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela authored Jun 24, 2022
1 parent d969ee7 commit 482dd42
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/services/api/src/modules/schema/module.graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export default gql`
type SchemaCheckSuccess {
valid: Boolean!
initial: Boolean!
changes: SchemaChangeConnection
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class SchemaPublisher {
]);

const schemas = latest.schemas;
const isInitialSchema = schemas.length === 0;

await this.tracking.track({
event: 'SCHEMA_CHECK',
Expand Down Expand Up @@ -189,7 +190,10 @@ export class SchemaPublisher {
}
}

return validationResult;
return {
...validationResult,
initial: isInitialSchema,
};
}

@sentry('SchemaPublisher.publish')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ export class SchemaValidator {
const errors = await orchestrator.validate(afterSchemasWithBase);

if (isInitialSchema) {
if (errors.length > 0) {
errors.push({
message: `Note: If this is your first schema publish, please make sure it's fully valid and standalone.`,
});
}

return {
valid: errors.length === 0,
errors: errors,
Expand Down

0 comments on commit 482dd42

Please sign in to comment.