Skip to content

Commit

Permalink
Merge branch 'main' into refactor/drop-type-variants
Browse files Browse the repository at this point in the history
  • Loading branch information
Shylock-Hg committed May 4, 2024
2 parents 017fec0 + 51373fe commit 47d3c68
Show file tree
Hide file tree
Showing 12 changed files with 413 additions and 172 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Head out to [docs] to learn about other powerful tailcall features.

Your contributions are invaluable! Kindly go through our [contribution guidelines] if you are a first time contributor.

[contribution guidelines]: https://tailcall.run/docs/contributors/guidelines/
[contribution guidelines]: https://tailcall.run/docs/contributors/

### Support Us

Expand Down
5 changes: 0 additions & 5 deletions generated/.tailcallrc.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,6 @@
},
"cache": {
"description": "Setting to indicate if the type can be cached.",
"default": null,
"anyOf": [
{
"$ref": "#/definitions/Cache"
Expand Down Expand Up @@ -1264,10 +1263,6 @@
}
]
},
"scalar": {
"description": "Flag to indicate if the type is a scalar.",
"type": "boolean"
},
"tag": {
"description": "Contains source information for the type.",
"anyOf": [
Expand Down
7 changes: 3 additions & 4 deletions src/blueprint/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fn process_field_within_type(context: ProcessFieldWithinTypeContext) -> Valid<Ty
}

let next_is_required = is_required && next_field.required;
if scalar::is_scalar(&next_field.type_of) {
if scalar::is_predefined_scalar(&next_field.type_of) {
return process_path(ProcessPathContext {
type_info,
config_module,
Expand Down Expand Up @@ -354,7 +354,7 @@ pub fn update_cache_resolvers<'a>(

fn validate_field_type_exist(config: &Config, field: &Field) -> Valid<(), String> {
let field_type = &field.type_of;
if !scalar::is_scalar(field_type) && !config.contains(field_type) {
if !scalar::is_predefined_scalar(field_type) && !config.contains(field_type) {
Valid::fail(format!("Undeclared type '{field_type}' was found"))
} else {
Valid::succeed(())
Expand Down Expand Up @@ -520,8 +520,7 @@ pub fn to_definitions<'a>() -> TryFold<'a, ConfigModule, Vec<Definition>, String

Valid::from_iter(config_module.types.iter(), |(name, type_)| {
let dbl_usage = input_types.contains(name) && output_types.contains(name);
// ShylockHg
if type_.scalar {
if type_.scalar() {
to_scalar_type_definition(name).trace(name)
} else if dbl_usage {
Valid::fail("type is used in input and output".to_string()).trace(name)
Expand Down
2 changes: 1 addition & 1 deletion src/blueprint/mustache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl<'a> MustachePartsValidator<'a> {

if !is_query && val_type.is_nullable() {
return Err(format!("value '{}' is a nullable type", item.as_str()));
} else if len == 1 && !scalar::is_scalar(val_type.name()) {
} else if len == 1 && !scalar::is_predefined_scalar(val_type.name()) {
return Err(format!("value '{}' is not of a scalar type", item.as_str()));
} else if len == 1 {
break;
Expand Down
2 changes: 1 addition & 1 deletion src/blueprint/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub fn validate_field_has_resolver(
if !field.has_resolver() {
let type_name = &field.type_of;
if let Some(ty) = types.get(type_name) {
if ty.scalar {
if ty.scalar() {
return true;
}
let res = validate_type_has_resolvers(type_name, ty, types);
Expand Down
Loading

0 comments on commit 47d3c68

Please sign in to comment.