Scalar types​

This section describes introspection of scalar types.

Introspection of the schema::ScalarType:

  1. with module schema
  2. select ObjectType {
  3. name,
  4. links: {
  5. name,
  6. },
  7. properties: {
  8. name,
  9. }
  10. }
  11. filter .name = 'schema::ScalarType';
  1. {
  2. Object {
  3. name: 'schema::ScalarType',
  4. links: {
  5. Object { name: '__type__' },
  6. Object { name: 'annotations' },
  7. Object { name: 'bases' },
  8. Object { name: 'constraints' },
  9. Object { name: 'ancestors' }
  10. },
  11. properties: {
  12. Object { name: 'default' },
  13. Object { name: 'enum_values' },
  14. Object { name: 'id' },
  15. Object { name: 'abstract' },
  16. Object { name: 'name' }
  17. }
  18. }
  19. }

Introspection of the built-in scalar str:

  1. with module schema
  2. select ScalarType {
  3. name,
  4. default,
  5. enum_values,
  6. abstract,
  7. bases: { name },
  8. ancestors: { name },
  9. annotations: { name, @value },
  10. constraints: { name },
  11. }
  12. filter .name = 'std::str';
  1. {
  2. Object {
  3. name: 'std::str',
  4. default: {},
  5. enum_values: {},
  6. abstract: {},
  7. bases: {Object { name: 'std::anyscalar' }},
  8. ancestors: {Object { name: 'std::anyscalar' }},
  9. annotations: {},
  10. constraints: {}
  11. }
  12. }

For an enumerated scalar type, consider the following:

  1. scalar type Color extending enum<Red, Green, Blue>;

Introspection of the enum scalar Color:

  1. with module schema
  2. select ScalarType {
  3. name,
  4. default,
  5. enum_values,
  6. abstract,
  7. bases: { name },
  8. ancestors: { name },
  9. annotations: { name, @value },
  10. constraints: { name },
  11. }
  12. filter .name = 'default::Color';
  1. {
  2. Object {
  3. name: 'default::Color',
  4. default: {},
  5. enum_values: ['Red', 'Green', 'Blue'],
  6. abstract: {},
  7. bases: {Object { name: 'std::anyenum' }},
  8. ancestors: {
  9. Object { name: 'std::anyscalar' },
  10. Object { name: 'std::anyenum' }
  11. },
  12. annotations: {},
  13. constraints: {}
  14. }
  15. }