Skip to content

Commit

Permalink
Merge pull request #13310 from hasezoey/fixWebsiteSeeLinks
Browse files Browse the repository at this point in the history
Fix schematype `@see` links
  • Loading branch information
vkarpov15 authored Apr 25, 2023
2 parents 76dfb7c + 2685d33 commit f50a194
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
32 changes: 24 additions & 8 deletions docs/source/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ const files = [
'lib/schema/array.js',
'lib/schema/documentarray.js',
'lib/schema/SubdocumentPath.js',
'lib/schema/boolean.js',
'lib/schema/buffer.js',
'lib/schema/number.js',
'lib/schema/objectid.js',
'lib/schema/string.js',
'lib/options/SchemaTypeOptions.js',
'lib/options/SchemaArrayOptions.js',
'lib/options/SchemaBufferOptions.js',
Expand Down Expand Up @@ -174,20 +179,29 @@ function processName(input) {
replace('/methods', '');
const lastSlash = name.lastIndexOf('/');
const fullName = name;
name = name.substr(lastSlash === -1 ? 0 : lastSlash + 1);
if (name === 'core_array') {
const basename = name.substr(lastSlash === -1 ? 0 : lastSlash + 1);
name = basename;
if (basename === 'core_array') {
name = 'array';
}
if (fullName === 'schema/array') {
name = 'SchemaArray';
if (fullName.startsWith('schema/')) {
name = 'Schema';
if (basename.charAt(0) !== basename.charAt(0).toUpperCase()) {
name += basename.charAt(0).toUpperCase() + basename.substring(1);
} else {
name += basename;
}
}
if (basename === 'SubdocumentPath') {
name = 'SubdocumentPath';
}
if (name === 'documentarray') {
if (basename === 'documentarray') {
name = 'DocumentArrayPath';
}
if (name === 'DocumentArray') {
if (basename === 'DocumentArray') {
name = 'MongooseDocumentArray';
}
if (name === 'index') {
if (basename === 'index') {
name = 'Mongoose';
}

Expand Down Expand Up @@ -434,8 +448,10 @@ function extractTextUrlFromTag(tag, ctx, warnOnMissingUrl = false) {
// "No Href" -> "No Href"
// "https://someurl.com" -> "" (fallback added)
// "Some#Method #something" -> "Some#Method"
// "Test ./somewhere" -> "Test"
// "Test2 ./somewhere#andsomewhere" -> "Test2"
// The remainder is simply taken by a call to "slice" (also the text is trimmed later)
const textMatches = /^(.*? (?=#|\/|(?:https?:)|$))/i.exec(tag.string);
const textMatches = /^(.*? (?=#|\/|(?:https?:)|\.\/|$))/i.exec(tag.string);

let text = undefined;
let url = undefined;
Expand Down
4 changes: 4 additions & 0 deletions lib/schema/boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ SchemaBoolean.prototype.checkRequired = function(value) {
* new M({ b: 'affirmative' }).b; // true
*
* @property convertToTrue
* @static
* @memberOf SchemaBoolean
* @type {Set}
* @api public
*/
Expand All @@ -176,6 +178,8 @@ Object.defineProperty(SchemaBoolean, 'convertToTrue', {
* new M({ b: 'nay' }).b; // false
*
* @property convertToFalse
* @static
* @memberOf SchemaBoolean
* @type {Set}
* @api public
*/
Expand Down
14 changes: 7 additions & 7 deletions lib/schematype.js
Original file line number Diff line number Diff line change
Expand Up @@ -993,13 +993,13 @@ SchemaType.prototype.validate = function(obj, message, type) {
* @param {Function} [options.ErrorConstructor] custom error constructor. The constructor receives 1 parameter, an object containing the validator properties.
* @param {String} [message] optional custom error message
* @return {SchemaType} this
* @see Customized Error Messages #error_messages_MongooseError-messages
* @see SchemaArray#checkRequired #schema_array_SchemaArray-checkRequired
* @see SchemaBoolean#checkRequired #schema_boolean_SchemaBoolean-checkRequired
* @see SchemaBuffer#checkRequired #schema_buffer_SchemaBuffer-schemaName
* @see SchemaNumber#checkRequired #schema_number_SchemaNumber-min
* @see SchemaObjectId#checkRequired #schema_objectid_ObjectId-auto
* @see SchemaString#checkRequired #schema_string_SchemaString-checkRequired
* @see Customized Error Messages ./error.html#Error.prototype.name
* @see SchemaArray#checkRequired ./schemaarray.html#SchemaArray.prototype.checkRequired()
* @see SchemaBoolean#checkRequired ./schemaboolean.html#SchemaBoolean.prototype.checkRequired()
* @see SchemaBuffer#checkRequired ./schemabuffer.html#SchemaBuffer.prototype.checkRequired()
* @see SchemaNumber#checkRequired ./schemanumber.html#SchemaNumber.prototype.checkRequired()
* @see SchemaObjectId#checkRequired ./schemaobjectid.html#ObjectId.prototype.checkRequired()
* @see SchemaString#checkRequired ./schemastring.html#SchemaString.prototype.checkRequired()
* @api public
*/

Expand Down

0 comments on commit f50a194

Please sign in to comment.