mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-11-04 01:37:32 +03:00 
			
		
		
		
	fix: default value for array query parameter (#2186)
This commit is contained in:
		
							parent
							
								
									0753bbea4b
								
							
						
					
					
						commit
						3d410b6002
					
				| 
						 | 
					@ -8,7 +8,7 @@ import {
 | 
				
			||||||
  TypePrefix,
 | 
					  TypePrefix,
 | 
				
			||||||
  TypeTitle,
 | 
					  TypeTitle,
 | 
				
			||||||
} from '../../common-elements/fields';
 | 
					} from '../../common-elements/fields';
 | 
				
			||||||
import { getSerializedValue } from '../../utils';
 | 
					import { getSerializedValue, isObject } from '../../utils';
 | 
				
			||||||
import { ExternalDocumentation } from '../ExternalDocumentation/ExternalDocumentation';
 | 
					import { ExternalDocumentation } from '../ExternalDocumentation/ExternalDocumentation';
 | 
				
			||||||
import { Markdown } from '../Markdown/Markdown';
 | 
					import { Markdown } from '../Markdown/Markdown';
 | 
				
			||||||
import { EnumValues } from './EnumValues';
 | 
					import { EnumValues } from './EnumValues';
 | 
				
			||||||
| 
						 | 
					@ -52,6 +52,10 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {
 | 
				
			||||||
    return null;
 | 
					    return null;
 | 
				
			||||||
  }, [field, showExamples]);
 | 
					  }, [field, showExamples]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const defaultValue = isObject(schema.default)
 | 
				
			||||||
 | 
					    ? getSerializedValue(field, schema.default).replace(`${field.name}=`, '')
 | 
				
			||||||
 | 
					    : schema.default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <div>
 | 
					    <div>
 | 
				
			||||||
      <div>
 | 
					      <div>
 | 
				
			||||||
| 
						 | 
					@ -92,7 +96,7 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {
 | 
				
			||||||
          <Badge type="warning"> {l('deprecated')} </Badge>
 | 
					          <Badge type="warning"> {l('deprecated')} </Badge>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      )}
 | 
					      )}
 | 
				
			||||||
      <FieldDetail raw={rawDefault} label={l('default') + ':'} value={schema.default} />
 | 
					      <FieldDetail raw={rawDefault} label={l('default') + ':'} value={defaultValue} />
 | 
				
			||||||
      {!renderDiscriminatorSwitch && (
 | 
					      {!renderDiscriminatorSwitch && (
 | 
				
			||||||
        <EnumValues isArrayType={isArrayType} values={schema.enum} />
 | 
					        <EnumValues isArrayType={isArrayType} values={schema.enum} />
 | 
				
			||||||
      )}{' '}
 | 
					      )}{' '}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user