-
Notifications
You must be signed in to change notification settings - Fork 405
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
feat: add operations tag to esr xml and operationId to yaml #6013
Merged
+37
−3
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CristiCanizales
requested review from
klewis-sfdc,
peternhale and
mingxuanzhangsfdx
and removed request for
klewis-sfdc
January 17, 2025 22:12
mingxuanzhangsfdx
approved these changes
Jan 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with a class
@RestResource(urlMapping='/property/*')
global with sharing class PropertyAPI implements PropertyAPIInterface {
@HttpGet
global static String getPropertyById() {
RestRequest request = RestContext.request;
// Grab the caseId from the end of the URL
String propertyId = request.requestURI.substring(
request.requestURI.lastIndexOf('/')+1);
return 'hello';
}
@HttpPost
global static String createProperty(String searchKey, Integer maxPrice, Integer minBedrooms, Integer minBathrooms) {
Property newProperty = new Property();
return 'world';
}
@TestVisible
private string anotherFunc() {
return 'hello';
}
public class Property {
public String Id;
public String Address;
public Integer Price;
public Integer Bedrooms;
public Integer Bathrooms;
}
@TestVisible
private Integer privateIntegerProperty;
@AuraEnabled
public String stringProperty { get; set; }
@AuraEnabled
public Decimal decimalProperty { get; set; }
@TestVisible
private List<String> privateListProperty;
@AuraEnabled
public List<Integer> integerListProperty { get; set; }
@AuraEnabled
public Map<String, String> stringMapProperty { get; set; }
public class PropertyException extends Exception {}
}
and got the result
<?xml version="1.0" encoding="UTF-8"?>
<ExternalServiceRegistration xmlns="http://soap.sforce.com/2006/04/metadata">
<description>This is an API for managing properties.</description>
<label>PropertyAPI</label>
<schema>openapi: 3.0.0
info:
title: Property API
version: '1.0.0'
description: This is an API for managing properties.
paths:
/PropertyAPI/createProperty:
post:
summary: Create a new property
operationId: createProperty
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Property'
responses:
'200':
description: The newly created property
content:
application/json:
schema:
$ref: '#/components/schemas/Property'
/PropertyAPI/getPropertyById:
get:
summary: Get a property by ID
operationId: getPropertyById
parameters:
- name: propertyId
in: path
required: true
description: The ID of the property to retrieve
schema:
type: string
responses:
'200':
description: The requested property
content:
application/json:
schema:
$ref: '#/components/schemas/Property'
components:
schemas:
Property:
type: object
properties:
Id:
type: string
Address:
type: string
Price:
type: integer
Bedrooms:
type: integer
Bathrooms:
type: integer
</schema>
<schemaType>OpenApi3</schemaType>
<schemaUploadFileExtension>yaml</schemaUploadFileExtension>
<schemaUploadFileName>propertyapi_openapi</schemaUploadFileName>
<status>Complete</status>
<systemVersion>3</systemVersion>
<operations>
<ExternalServiceOperation>
<name>createProperty</name>
<active>true</active>
</ExternalServiceOperation>
<ExternalServiceOperation>
<name>getPropertyById</name>
<active>true</active>
</ExternalServiceOperation>
</operations>
<registrationProvider>PropertyAPI</registrationProvider>
<registrationProviderType>Custom</registrationProviderType>
<namedCredentialReference>somenamed</namedCredentialReference>
</ExternalServiceRegistration>
which looks good
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
What issues does this PR fix or reference?
@W-17626169@
ESR