mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-11-04 01:37:32 +03:00 
			
		
		
		
	It is possible to define alternative required scopes for an operation and in the security header of the operation it is rendered correctly. However, in the "Required scopes" part it looks like that all these scopes are required. With these changes, the "Required scopes" part shows the required scopes per set. See: https://github.com/OAI/OpenAPI-Specification/discussions/3001#discussioncomment-3456275
		
			
				
	
	
		
			26 lines
		
	
	
		
			667 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			667 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import * as React from 'react';
 | 
						|
 | 
						|
export const RequiredScopesRow = ({ scopeSets }: { scopeSets: string[][] }): JSX.Element | null => {
 | 
						|
  if (!scopeSets.length) return null;
 | 
						|
 | 
						|
  return (
 | 
						|
    <div>
 | 
						|
      <b>Required scopes: </b>
 | 
						|
      {scopeSets.map((scopeSet, ssIdx) => {
 | 
						|
        return (
 | 
						|
          <React.Fragment key={ssIdx}>
 | 
						|
            {scopeSet.map((scope, idx) => {
 | 
						|
              return (
 | 
						|
                <React.Fragment key={idx}>
 | 
						|
                  <code>{scope}</code>{' '}
 | 
						|
                </React.Fragment>
 | 
						|
              );
 | 
						|
            })}
 | 
						|
            {ssIdx + 1 < scopeSets.length && ' or '}
 | 
						|
          </React.Fragment>
 | 
						|
        );
 | 
						|
      })}
 | 
						|
    </div>
 | 
						|
  );
 | 
						|
};
 |