Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema qeustion: field required #587

Open
teunlielu opened this issue Oct 16, 2024 · 1 comment
Open

Schema qeustion: field required #587

teunlielu opened this issue Oct 16, 2024 · 1 comment
Labels

Comments

@teunlielu
Copy link

How can you indicate in the diagram that the field is required?
You can indicate that the field must have at least 1 chars. Does not work if field is not sent at all.

image

code

  #[Key('ZIPcode')]
   #[Description('ZIPcode')]
   #[MinLength(1)]
   #[MaxLength(15)]
   protected ?string $zIPcode = null;


$schemaManager = new \PSX\Schema\SchemaManager();
   			// we read the schema from the class
   			$schema = $schemaManager->getSchema(\App\Model\XYZ::class);
   			
   			$X = (new \PSX\Schema\SchemaTraverser())->traverse($body, $schema, new \PSX\Schema\Visitor\TypeVisitor());


Code is generate over:
https://typeapi.org/generator not over site.

@chriskapp
Copy link
Member

Hi @teunlielu currently this is not possible, in general the idea is to only describe the properties and then you can check in your app the required fields, this is also useful if you need specific error messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants