Release | Build Status |
---|---|
Edge | |
Latest |
GraphQL endpoint providing a single endpoint to access data from Argo's many services.
- Set up environment: copy
.env.schema
to.env
and update environment accordingly if needed. Values provided in the schema file can be used when running the server locally for development. - Install dependencies:
npm ci
(depending on your Node version, it may require a '--legacy-peer-deps' flag) - Navigate to
./compose
and rundocker-compose up -d
to start up elasticsearch npm run programDashboardEsInit && npm run fileCentricEsInit
to initialize some data to elasticsearch for local development- Run server locally:
npm run dev
-
Nullable VS Non-null fields:
- When adding fields to type
DonorSummaryEntry
, sinceprogramDonorSummaryEntries
API gets data from ESdonor-summary-submission
indices, we must first determine if the data source of the new field is already populated in ES. if the new field can be null in ES index, mark the graphql field as nullable; if the new field is non-null in ES index, mark the grphql field with!
to indicate that it's non-null.
Example:
type User { name: String! // non-null age: Int // nullable }
- When adding fields to type
-
Digging deeper: Nulls in the response
- If you get a null value for a non-null field, GraphQL returns a data collection of
null
, meaning it doesn't return other fields even if they have values. This is why we must identify fields' nullability before adding them to schema:
data: { user: null; }
- If you get a null value for a nullable field, GraphQL returns
null
for this field and other fields:
data: { user: { name: null, age: 25, // other fields on user } }
- If you get a null value for a non-null field, GraphQL returns a data collection of