Skip to content

Custom rule #413

Closed Answered by romalytvynenko
fixytech asked this question in Q&A
Discussion options

You must be logged in to vote

@fixytech hey!

You can implement method docs on your rule class:

use Dedoc\Scramble\Support\Generator\Types\Type as OpenApiType;

public function docs(OpenApiType $prevType, TypeTransformer $openApiTransformer): OpenApiType;

For example:

use Dedoc\Scramble\Support\Generator\Types\Type as OpenApiType; 
use Dedoc\Scramble\Support\Generator\Types\StringType; 

public function docs(OpenApiType $prevType, TypeTransformer $openApiTransformer): OpenApiType
{
    return (new StringType)->format('password');
} 

This is not documented feature as in the near future I plan to change namespaces and potentially the API for this feature.

But for now it should do the work.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by romalytvynenko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants