fusio icon indicating copy to clipboard operation
fusio copied to clipboard

Schema qeustion: field required

Open teunlielu opened this issue 1 year ago • 1 comments

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.

teunlielu avatar Oct 16 '24 13:10 teunlielu

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.

chriskapp avatar Oct 18 '24 18:10 chriskapp