mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-10-31 07:47:29 +03:00 
			
		
		
		
	
							parent
							
								
									4adb927463
								
							
						
					
					
						commit
						4494f80dbc
					
				|  | @ -381,6 +381,14 @@ describe('Utils', () => { | |||
|         'objects (Pet) or numbers <int64>', | ||||
|       ); | ||||
|     }); | ||||
| 
 | ||||
|     it('should not pluralize display types that are already pluralized', () => { | ||||
|       expect(pluralizeType('strings')).toEqual('strings'); | ||||
|       expect(pluralizeType('objects (Pet)')).toEqual('objects (Pet)'); | ||||
|       expect(pluralizeType('strings <email>')).toEqual('strings <email>'); | ||||
|       expect(pluralizeType('objects or strings')).toEqual('objects or strings'); | ||||
|       expect(pluralizeType('objects (Pet) or numbers <int64>')).toEqual('objects (Pet) or numbers <int64>'); | ||||
|     }); | ||||
|   }); | ||||
| 
 | ||||
|   describe('openapi serializeParameter', () => { | ||||
|  |  | |||
|  | @ -579,6 +579,6 @@ export function extractExtensions(obj: object, showExtensions: string[] | true): | |||
| export function pluralizeType(displayType: string): string { | ||||
|   return displayType | ||||
|     .split(' or ') | ||||
|     .map(type => type.replace(/^(string|object|number|integer|array|boolean)( ?.*)/, '$1s$2')) | ||||
|     .map(type => type.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/, '$1s$2')) | ||||
|     .join(' or '); | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user