babel-plugin-prop-types-schema-generator
Version:
Transfer react prop types to JSON schema
25 lines (24 loc) • 337 B
JavaScript
Comp.schema = {
type: "object",
required: ["str2", "str4"],
properties: {
str1: {
type: "string"
},
str2: {
type: "string"
},
str3: {
type: "string"
},
str4: {
type: "string"
}
}
};
Comp.propTypes = {
str1: PropTypes.string,
str2: PropTyeps.string.isRequired,
str3: string,
str4: string.isRequired
};