We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi. I found the bug when nested fields in the schema are not omitted, for example:
const User = mongoose.model("User", { name: { type: String }, phone: { type: String }, email: { title: "email", type: String, lowercase: true, required: false }, address: { default: {}, required: true, type: new mongoose.Schema({ country: { title: "Country", type: String } }) } });
const swaggerSchema = m2s(User, { props: ["title"], omitFields: ["address.country"] }); console.log(swaggerSchema);
So the swaggerSchema.address.country not omitted. The bug in this line
swaggerSchema.address.country
It happens, because the country field is not exists in the root schema, country field has another path: schema.tree.address.type.tree.country
country
schema.tree.address.type.tree.country
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi. I found the bug when nested fields in the schema are not omitted, for example:
const User = mongoose.model("User", { name: { type: String }, phone: { type: String }, email: { title: "email", type: String, lowercase: true, required: false }, address: { default: {}, required: true, type: new mongoose.Schema({ country: { title: "Country", type: String } }) } });
const swaggerSchema = m2s(User, { props: ["title"], omitFields: ["address.country"] }); console.log(swaggerSchema);
So the
swaggerSchema.address.country
not omitted.The bug in this line
It happens, because the
country
field is not exists in the root schema,country
field has another path:schema.tree.address.type.tree.country
The text was updated successfully, but these errors were encountered: