Skip to content
Last updated

Here are the answers to your questions based on the Redocly documentation:

1. Protecting debrief.md with "pearl" role access

To restrict access to a specific page like debrief.md, you'll need to use Redocly's Access Control feature:

  1. In your redocly.yaml configuration file, define the pearl role and assign it to the protected path:
acl:
  roles:
    pearl: # Define your role
      description: Special access role
  resources:
    - /debrief.md: # Path to protect
        allowedRoles: [pearl] # Only pearl role can access
  1. Configure your authentication provider to handle role assignment.

2. Creating a code walkthrough

Redocly supports code walkthroughs using OpenAPI Code Samples:

  1. Add code samples to your OpenAPI spec using x-codeSamples:
paths:
  /pets:
    get:
      x-codeSamples:
        - lang: JavaScript
          source: |
            fetch('/pets')
              .then(response => response.json())
              .then(data => console.log(data));
  1. Use Markdown with tabs to create step-by-step explanations:
## Walkthrough

::: tabs

### Step 1: Request setup
```javascript
const url = '/api/v1/pets';

Step 2: Send request

fetch(url)
  .then(/* ... */);

:::


### 3. Showing only mock server in Try It console
Configure the `x-displayServers` extension in your OpenAPI spec:

```yaml
servers:
  - url: https://real.api.com
    description: Production
  - url: https://mock.api.com
    description: Mock

x-displayServers:
  - https://mock.api.com

4. Running API monitoring on a schedule

Use Redocly's API Monitoring with CI/CD integration:

  1. Create a monitoring.yaml file:
checks:
  response-time:
    request:
      url: /api/v1/users
      method: GET
    assertions:
      - response-time < 1000
  1. Set up a cron job in your CI system (GitHub Actions example):
on:
  schedule:
    - cron: ‘0 8 * * *’ # Daily at 8 AM
jobs:
  monitor:
    runs-on: ubuntu-latest
    steps:
      - uses: redocly/cli@latest
        with:
          command: monitor monitoring.yaml

5. Making headings purple in Redocly

Customize colors using a theme extension in your redocly.yaml:

theme:
  colors:
    primary:
      main: ‘#6a0dad’ # Purple color
    text:
      primary: ‘#6a0dad’ # For headings

Or use CSS overrides:

theme:
  styles:
    headings:
      color: ‘#6a0dad’
      fontFamily: ‘Arial’

Note: Exact color control may require custom CSS via the theme.styles property or using their styling API.