Data types and the Common Data Model
A data type is a specific kind of data, defined by the values it can contain and how those are accessed.
For example, an
Integer is a
Scalar data type that can hold a whole number and an
Object is a data type that has named fields with their own data types and values.
CloudBees SDM uses several kinds of GraphQL data types, including
Interface, to define the CloudBees SDM Common Data Model.
Objectrepresents an item of data that has fields, each each of these fields has its own data type.
Scalaris a simple value like a
Enumis a type with a fixed list of values, for example you might have an
Objectwith a status field that can be either
Interfacetypes define the CloudBees SDM Common Data Model.
Interface represents an abstraction, a way to treat data types in a generic way. For example, you might be using Jira and GitHub for issue tracking, and you want to define a policy or a report that treats issues in a generic way.
You want a report that includes all of your tickets, not just the ones in Jira.
That’s why CloudBees SDM defines an
Issue interface, which defines the fields that all issues must provide.
The Common Data Model is a set of interfaces that represent the common data types that exist in SDLC systems. For example:
IssueCommentsexist in issue tracking systems like Jira
Jobexist in CI and CD systems like Jenkins
Pull Requestexist in source control management (SCM) systems like GitHub
When you write a query for a report or policy, you should use interfaces when you want to report across all of the different "brands" of SDLC systems that you use. For example, you want to write a policy that alerts you when pull requests are stale in any of your SCMs whether they are Git, GitHub, or others.
Behind the scenes of CloudBees SDM, data types are defined by a GraphQL schema. These notions of
Interfaces are all defined by GraphQL.
To learn more about how GraphQL types and schemas work, please refer to the GraphQL documentation (https://graphql.org/learn/schema/).