Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create OpenAPI Document: Failed to validate eligibility. #6151

Open
infallibletechie opened this issue Mar 13, 2025 · 4 comments
Open

Comments

@infallibletechie
Copy link

Summary

SFDX: Create OpenAPI Document from this Class (Beta) is not working

Steps To Reproduce:

  1. Create an Apex Class.
  2. Use SFDX: Create OpenAPI Document from this Class (Beta) command

Expected result

OpenAPI Document files should be generated

Actual result

Failed to create OpenAPI Document: Failed to validate eligibility.

@smarvez smarvez transferred this issue from forcedotcom/Einstein-GPT-for-Developers Mar 17, 2025
@svc-idee-bot
Copy link
Collaborator

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@svc-idee-bot
Copy link
Collaborator

Hello @infallibletechie 👋 It looks like you didn't provide all the required basic info in your issue.

If you haven't already, please provide the following info:
Salesforce Extension Version in VS Code:
Salesforce CLI Version:
OS and version:
VS Code version:
Most recent version of the extensions where this was working:

Here's an example of a set of required info that will pass the validation:
Salesforce Extension Version in VS Code: 60.13.0
Salesforce CLI Version: @salesforce/cli/2.42.6 darwin-arm64 node-v18.18.2
OS and version: MacOS Sonoma 14.5
VS Code version: 1.89.1
Most recent version of the extensions where this was working: 60.11.0

A few more things to check:

  • Make sure you've provided detailed steps to reproduce your issue, as well as all error messages that you see.
    • A repository that clearly demonstrates the bug is ideal.
    • Error messages can be found in the Problems Tab, Output Tab, and from running Developer: Toggle Developer Tools in the command palette.
  • Make sure you've installed the latest version of the Salesforce Extension Pack for VSCode. (docs)
  • Search GitHub for existing related issues.

Thank you!

@daphne-sfdc
Copy link
Contributor

Hi @infallibletechie, I assume you created the Apex class using SFDX: Create Apex Class and then tried to generate the OpenAPI document from the class created from the default template, correct? If yes, the error that you're seeing is the expected behavior. We only support generating OpenAPI documents for Apex REST classes, which are annotated with @RestResource. Please refer to the official documentation here: https://developer.salesforce.com/docs/einstein/genai/guide/agent-apex.html

@infallibletechie
Copy link
Author

I used Apex REST only.

@RestResource( urlMapping='/CaseApexAPI/v1/Cases/*' )
global without sharing class CaseRESTAPIController {

@HttpPost
global static String importCase(
    String subject, 
    String description
) {

    System.debug( '### importCase ###' );
    System.debug( 'subject: ' + subject );
    System.debug( 'description: ' + description );
    
    Case objCase = new Case(
        Status= 'New',
        Origin= 'Web',
        Priority= 'Low',
        Subject = subject,
        Description = description
    );

    try {

        insert objCase;
        return 'Case created for you!!!';
        
    } catch ( DMLException e ) {

        return e.getMessage();
        
    }
    
}

}

It works in one laptop and not from another laptop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants