Skip to content

Commit

Permalink
Add namespace shortcut - #26
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrokeil committed Feb 18, 2021
1 parent eafc7df commit 2dcab5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/ValueObjectFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,10 @@ private function extractNamespace(string $classNamespacePath, TypeDefinition $ty
}
$namespace = $typeDefinition->custom()['namespace'] ?? '';

if ($namespace === '') {
$namespace = $typeDefinition->custom()['ns'] ?? '';
}

return \trim($classNamespacePath . '\\' . $namespace, '\\');
}

Expand Down
2 changes: 1 addition & 1 deletion tests/_files/schema_shorthand_namespace.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"billing_address": "Address|namespace:Billing",
"address?": "ShippingAddresses|namespace:Payment"
"address?": "ShippingAddresses|ns:Payment"
}

0 comments on commit 2dcab5b

Please sign in to comment.