IJsonSchemaAttribute is a common interface for all JSON schema
types supported in here @samchon/openapi. Here is the list of
affected JSON schema types in @samchon/openapi, and you can extend
the interface by declaring module augmentation.
For example, if you extend the IJsonSchemaAttribute interface
like below, every JSON schema types in @samchon/openapi will have
a new custom attribute x-wrtn-placeholder.
Also, if you augment the nested type like
IJsonSchemaAttribute.IString, you can add the custom attribute
to every string types in the JSON schema. In the below example case,
every string types will have a new custom attribute
x-wrtn-secret-key.
declaremodule"@samchon/openapi" { exportinterfaceIJsonSchemaAttribute { /// Placeholder value for frontend application /// /// Placeholder ia label shown in the input field as a hint. /// For example, when an email input field exists, the label /// value would be "Insert your email address here". "x-wrtn-placeholder"?: string; } exportnamespaceIJsonSchemaAttribute { exportinterfaceIString { /// Secret key for the schema. /// /// `x-wrtn-secret-key` is a property means a secret key /// that is required for the target API endpoint calling. /// If the secret key is not filled, the API call would /// be failed. "x-wrtn-secret-key"?: string; } } }
Common attributes for JSON schema types.
IJsonSchemaAttribute
is a common interface for all JSON schema types supported in here@samchon/openapi
. Here is the list of affected JSON schema types in@samchon/openapi
, and you can extend the interface by declaring module augmentation.For example, if you extend the
IJsonSchemaAttribute
interface like below, every JSON schema types in@samchon/openapi
will have a new custom attributex-wrtn-placeholder
.Also, if you augment the nested type like
IJsonSchemaAttribute.IString
, you can add the custom attribute to every string types in the JSON schema. In the below example case, every string types will have a new custom attributex-wrtn-secret-key
.Author
Jeongho Nam - https://github.com/samchon